Changeset 91 for trunk/src/xmlmodel.h


Ignore:
Timestamp:
Apr 8, 2008, 8:52:18 AM (11 years ago)
Author:
cameron
Message:

ATTLIST semantics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/xmlmodel.h

    r67 r91  
    2222#ifndef XMLMODEL_H
    2323#define XMLMODEL_H
     24#include <vector>
     25#include <iostream>
     26#include <string>
     27#include <ext/hash_map>
    2428
     29using namespace __gnu_cxx;
     30using namespace std;
    2531
    2632enum XML_version {XML_1_0, XML_1_1, no_XML_version_value};
     
    6874
    6975
     76/* Attribute Modeling */
     77
     78enum ATT_type {CDATA_att, ID_att, IDREF_att, IDREFS_att, ENTITY_att, ENTITIES_att,
     79               NMTOKEN_att, NMTOKENS_att, NOTATION_att, enumeration_att};
     80/* Possible attribute types as specified in ATTLIST declarations. */
     81
     82enum ATT_default_kind {REQUIRED_att, IMPLIED_att, FIXED_att, DEFAULT_att};
     83/* Possible kinds of attribute default in ATTLIST declarations. */
     84
     85class ATT_info {
     86public:
     87        int globalATT_id;
     88        ATT_type attType;
     89        vector<string> enumValues; /* For NOTATION_att or enumeration_att.*/
     90        ATT_default_kind defaultKind;
     91        unsigned char * defaultValue;
     92        int defaultValueLgth;
     93};
     94
     95/* The complete Attribute model for a given element is a vector of ATT_info
     96   specifications for particular attribute names. */
     97//typedef vector<ATT_info> ElementAttributeModel;
     98
     99struct eqstr
     100{
     101  bool operator()(const char* s1, const char* s2) const
     102  {
     103    return strcmp(s1, s2) == 0;
     104  }
     105};
     106
    70107class Model_Info {
    71108       
    72109public:
     110        Model_Info();
    73111        ~Model_Info();
    74112
     
    88126        unsigned char * encoding;
    89127        XML_standalone standalone;
    90 
     128       
     129        /* Information computed from ATTLIST declarations. */
     130        hash_map<const char *, int, hash<const char *>, eqstr > GlobalAttributeTable;
     131        hash_map<const char *, int, hash<const char *>, eqstr > GlobalElementTable;
     132        int globalElementCount;
     133        int globalAttributeCount;
     134       
     135    /* For each element, we have an ElementAttributeModel */
     136        vector<vector<ATT_info *> > ElementAttributeData;
     137        int getOrInsertGlobalElement(unsigned char * elem_name, int lgth);
     138        int getOrInsertGlobalAttName(unsigned char * att_name, int lgth);
    91139private:
    92140        void set_charset_family(CodeUnit_Base C, CodeUnit_Size S, CodeUnit_ByteOrder O, int B);
Note: See TracChangeset for help on using the changeset viewer.