1
/* xmlmodel.h - 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
7
The XML Model Processor gathers information that guides
8
interpretation of an XML document as it is processed.
9
This information arises from a variety of sources,
11
(a) the document prolog, including
12
(a1) the encoding signature,
13
(a2) the XML declaration (or text declaration for
14
external entities), and
15
(a3) the Document Type Definition (internal and
18
(b) XML Schema documents (and/or Relax NG, Schematron)
19
(c) XPath sets specifying information to retrieve.
25
// Encoding signature, XML declaration processing included in xmldecl.h
31
#include <ext/hash_map>
33
using namespace __gnu_cxx;
36
#include "contentmodel.h"
40
/* Attribute Modeling */
42
enum ATT_type {CDATA_att, ID_att, IDREF_att, IDREFS_att, ENTITY_att, ENTITIES_att,
43
NMTOKEN_att, NMTOKENS_att, NOTATION_att, enumeration_att};
44
/* Possible attribute types as specified in ATTLIST declarations. */
46
enum ATT_default_kind {REQUIRED_att, IMPLIED_att, FIXED_att, DEFAULT_att};
47
/* Possible kinds of attribute default in ATTLIST declarations. */
54
hash_map<int, int > enumValues; /* For NOTATION_att or enumeration_att.*/
55
ATT_default_kind defaultKind;
56
unsigned char * defaultValue;
65
const char * ReplacementText;
77
char * ReplacementText;
82
/* The complete Attribute model for a given element is a vector of ATT_info
83
specifications for particular attribute names. */
84
//typedef vector<ATT_info> ElementAttributeModel;
99
bool has_external_DTD;
100
char * external_DTD_systemLiteral;
101
char * external_DTD_pubidLiteral;
102
Symbol_Table * symbol_table;
105
/* Information computed from ATTLIST, ELEMENT, NOTATION and ENTITY declarations. */
107
hash_map<int, int > GlobalAttributeTable;
108
hash_map<int, int > GlobalElementTable;
109
hash_map<int, int > GlobalNotationTable;
110
hash_map<int, int > GlobalGEntityTable;
111
hash_map<int, int > GlobalPEntityTable;
114
int globalElementCount;
115
int globalAttributeCount;
116
int globalNotationCount;
117
int globalGEntityCount;
118
int globalPEntityCount;
119
/* For each element, we have an ElementAttributeModel */
120
vector<vector<ATT_info *> > ElementAttributeData;
121
int getOrInsertGlobalElement(int elem_nameID);
122
int getOrInsertGlobalAttName(int att_nameID);
123
// rootModel is a content model for the document root, consisting
124
// of a single occurrence of the element named in the DOCTYPE declaration.
125
CM_RegExp * rootModel;
126
// vector<ContentModel *> ContentModelData;
127
hash_map<int, ContentModel * > ContentModelData;
130
vector<GEntity_info *> GEntityData;
131
vector<PEntity_info *> PEntityData;
132
vector<Notation_info *> NotationData;
134
void SimpleEntity(const char * entity_Name, const char * replText);
137
#endif /*XMLMODEL_H*/