source: trunk/src/xmlmodel.c @ 163

Last change on this file since 163 was 163, checked in by cameron, 11 years ago

Restructuring: Document/Externalt? Entity Info into xmldecl.h

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