1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/* xmlmodel.c - XML Model Processor
Copyright (c) 2007, 2008 Robert D. Cameron
Licensed to the public under the Open Software License 3.0.
Licensed to International Characters, Inc., under the Academic
Free License 3.0.
*/
#include "multiliteral.h"
#include "xmlmodel.h"
void Model_Info::SimpleEntity(char * entity_Name, char * replText) {
int entity_NameID = symbol_table->Insert_Name(entity_Name, strlen(entity_Name));
int entityID = GlobalGEntityTable[entity_NameID];
if(entityID==0){
GEntity_info * this_info = new GEntity_info;
GlobalGEntityTable[entity_NameID]=++(globalGEntityCount);
entityID = globalGEntityCount;
this_info->globalGEntity_id = entityID;
this_info->is_external = false;
this_info->ReplacementText = replText;
this_info->systemLiteral = NULL;
this_info->pubidLiteral = NULL;
this_info->NDataName = NULL;
this_info->is_simple = true;
GEntityData.push_back(this_info);
}
}
Model_Info::Model_Info() {
ElementAttributeData.push_back(vector<ATT_info *>());
globalElementCount = 0;
globalAttributeCount = 0;
symbol_table = new Symbol_Table();
SimpleEntity("lt", "<");
SimpleEntity("gt", ">");
SimpleEntity("amp", "&");
SimpleEntity("quot", "\"");
SimpleEntity("apos", "'");
}
Model_Info::~Model_Info() {
}
int Model_Info::getOrInsertGlobalElement(int elem_nameID) {
int elemID = GlobalElementTable[elem_nameID];
if(elemID==0){
GlobalElementTable[elem_nameID]=++(globalElementCount);
elemID = globalElementCount;
ElementAttributeData.push_back(vector<ATT_info *>());
}
return elemID;
}
int Model_Info::getOrInsertGlobalAttName(int att_nameID){
int attID = GlobalAttributeTable[att_nameID];
if(attID==0){
GlobalAttributeTable[att_nameID]=++(globalAttributeCount);
attID = globalAttributeCount;
}
return attID;
}
|