Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

dtd_processor Class Reference

class process DTD into internal grammar More...

#include <dtdxml.h>

Inheritance diagram for dtd_processor:

byte_manager

List of all members.

Public Member Functions

 dtd_processor (byte_source &stream, xml_document &doc, mem_pool_t &small_pool, mem_pool_t &big_pool, size_t xml_size)
 constructor
void parse ()
 parse DTD

Private Member Functions

void parseSubSet (char stopSymbol, bool include_allowed)
 parses subset dtd can be built into main document text [' (markupdecl | DeclSep)* ']' [30] extSubset ::= TextDecl? extSubsetDecl
void parseElement ()
 parser element [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment [28a] DeclSep ::= PEReference | S [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>' element starts with '<!ELEMENT'
void parseContentSpec (elementDecl &decl)
 parses content of element [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children
dfa_tokenparseMixed ()
 parses mixed content type [51] Mixed ::= '(' S? 'PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? 'PCDATA' S? ')'
dfa_tokenparseChildren ()
 parses children content type [47] children ::= (choice | seq) ('?' | '*' | '+')? [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? [49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'
void parseAttrList ()
 parses attribute list [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>'
void parseAttDef (elementDecl &decl)
 parses attribute definition [53] AttDef ::= S Name S AttType S DefaultDecl
void parseAttrEnumeration (attributeDecl &decl)
 attribute as enumaration [54] AttType ::= StringType | TokenizedType | EnumeratedType [55] StringType ::= 'CDATA' [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' [57] EnumeratedType ::= NotationType | Enumeration [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'
void parseDefaultDecl (attributeDecl &decl)
 parses attribute default value [60] DefaultDecl ::= 'REQUIRED' | 'IMPLIED' | (('FIXED' S)? AttValue)
void parsePEReference (bool skip_junk_before, bool skip_junk_after)
 parses reference [10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" [67] Reference ::= EntityRef | CharRef [68] EntityRef ::= '&' Name ';' [69] PEReference ::= '' Name ';'
void parseEntity ()
 parses entity [70] EntityDecl ::= GEDecl | PEDecl
void parseEntityDef (entityDecl &decl)
 parser entity definition [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>'
void parseNotation ()
 below parsing defined in base class [72] PEDecl ::= '<!ENTITY' S '' S Name S PEDef S? '>' [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) [74] PEDef ::= EntityValue | ExternalID [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'" [75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral [76] NDataDecl ::= S 'NDATA' S Name
void parseInclude ()
 following parses defined in base class [83] PublicID ::= 'PUBLIC' S PubidLiteral [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) [15] Comment ::= '' [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
void parseIgnore ()
 parses ignore list
dfa_tokencheckRepeation (ub1_t symbol, dfa_token *token)
 checks if the symbol is repeated
const entityDeclexpandPEReference (paged_buffer &buffer)
 expands the reference into entity declaration
vt_types convert_ctype (const char *x)
 converts CTYPE type to terimber virtual type non standard terimber extension of DTD
void validate ()
 validates DTD
void deterministic_model (const dfa_token *token)
 validates the deterministic model


Detailed Description

class process DTD into internal grammar

Definition at line 39 of file dtdxml.h.


Constructor & Destructor Documentation

BEGIN_TERIMBER_NAMESPACE dtd_processor::dtd_processor ( byte_source stream,
xml_document doc,
mem_pool_t small_pool,
mem_pool_t big_pool,
size_t  xml_size 
)

constructor

Parameters:
stream  input byte sequence
doc  document that will keep the grammar as a result of DTD parsing
small_pool  pool of allocators
big_pool  pool of allocators
xml_size  default size for allocators

Definition at line 47 of file dtdxml.cpp.


Member Function Documentation

void dtd_processor::parseSubSet ( char  stopSymbol,
bool  include_allowed 
) [private]

parses subset dtd can be built into main document text [' (markupdecl | DeclSep)* ']' [30] extSubset ::= TextDecl? extSubsetDecl

Parameters:
stopSymbol  stop symbol
include_allowed  flag if aditional includes are allowed

Definition at line 71 of file dtdxml.cpp.

References byte_manager::_doc, ch_A, ch_bang, ch_dash, ch_E, ch_G, ch_I, ch_L, ch_N, ch_open_angle, ch_open_square, ch_percent, ch_question, xml_document::get_tmp_allocator(), parseAttrList(), byte_manager::parseComment(), parseElement(), parseEntity(), parseIgnore(), parseInclude(), parseNotation(), parsePEReference(), byte_manager::parsePI(), byte_manager::pick(), byte_manager::pop(), byte_allocator::reset(), byte_manager::reset_all_tmp(), byte_manager::skip_sign(), byte_manager::skip_white_space(), and byte_manager::throw_exception().

Referenced by parse(), and parseInclude().

void dtd_processor::parseElement (  )  [private]

parser element [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment [28a] DeclSep ::= PEReference | S [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>' element starts with '<!ELEMENT'

Definition at line 241 of file dtdxml.cpp.

References byte_manager::_doc, xml_grammar::add_element_decl(), xml_document::add_element_desc(), ch_close_angle, parseContentSpec(), byte_manager::parseName(), parsePEReference(), byte_manager::skip_sign(), byte_manager::skip_string(), byte_manager::skip_white_space(), and str_ELEMENT.

Referenced by parseSubSet().

void dtd_processor::parseContentSpec ( elementDecl decl  )  [private]

dfa_token * dtd_processor::parseChildren (  )  [private]

parses children content type [47] children ::= (choice | seq) ('?' | '*' | '+')? [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? [49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'

[50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'

Definition at line 420 of file dtdxml.cpp.

References byte_manager::_doc, dfa_token::_first, dfa_token::_last, xml_grammar::add_element_decl(), byte_allocator::allocate(), ch_close_paren, ch_comma, ch_open_paren, ch_pipe, check_pointer(), checkRepeation(), DFA_CHOICE, DFA_LEAF, DFA_SEQUENCE, xml_document::get_model_allocator(), byte_manager::parseName(), parsePEReference(), byte_manager::pick(), byte_manager::pop(), and byte_manager::throw_exception().

Referenced by parseContentSpec().

void dtd_processor::parseAttrList (  )  [private]

void dtd_processor::parseAttDef ( elementDecl decl  )  [private]

parses attribute definition [53] AttDef ::= S Name S AttType S DefaultDecl

Parameters:
decl  element declaration

Definition at line 742 of file dtdxml.cpp.

References elementDecl::_attributes, attributeDecl::_atype, elementDecl::_content, attributeDecl::_ctype, attributeDecl::_defval, byte_manager::_doc, attributeDecl::_enum, namedNode::_name, attributeDecl::_rule, byte_manager::_tmp_allocator, enumNodeDecl::_value, xml_grammar::add_attribute_decl(), ATTR_RULE_FIXED, ATTR_RULE_IMPLIED, ATTR_RULE_REQUIRED, ATTR_TYPE_CDATA, ATTR_TYPE_ENTITIES, ATTR_TYPE_ENTITY, ATTR_TYPE_ENUMERATION, ATTR_TYPE_ID, ATTR_TYPE_IDREF, ATTR_TYPE_IDREFS, ATTR_TYPE_NMTOKEN, ATTR_TYPE_NMTOKENS, ATTR_TYPE_NOTATION, base_list< T >::back(), base_list< T >::begin(), base_map< K, T, Pr, M >::begin(), ch_C, ch_D, ch_E, ch_I, ch_M, ch_N, ch_open_paren, ch_R, ch_S, ch_Y, base_map< size_t, attributeDecl, less< size_t >, M >::const_iterator, CONTENT_EMPTY, convert_ctype(), base_list< T >::empty(), base_list< T >::end(), base_map< K, T, Pr, M >::end(), base_list< T >::front(), base_string< T >::length(), parseAttrEnumeration(), parseDefaultDecl(), byte_manager::parseName(), parsePEReference(), byte_manager::pick(), byte_manager::pop(), _list< T, A >::size(), byte_manager::skip_string(), byte_manager::skip_white_space(), str_CDATA, str_CTYPE, str_default, str_ENTIT, str_ID, str_NMTOKEN, str_NOTATION, str_preserve, str_REF, str_xml_space, str_template::strcmp(), byte_manager::throw_exception(), tokenValues(), vt_enum, and vt_string.

Referenced by parseAttrList().

void dtd_processor::parseAttrEnumeration ( attributeDecl decl  )  [private]

attribute as enumaration [54] AttType ::= StringType | TokenizedType | EnumeratedType [55] StringType ::= 'CDATA' [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' [57] EnumeratedType ::= NotationType | Enumeration [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'

Parameters:
decl  attribute declaration

Definition at line 974 of file dtdxml.cpp.

References byte_manager::_doc, attributeDecl::_enum, ch_close_paren, ch_open_paren, ch_pipe, xml_document::get_model_allocator(), parsePEReference(), byte_manager::parseValue(), byte_manager::pick(), byte_manager::pop(), _list< T, A >::push_back(), byte_manager::skip_sign(), and byte_manager::skip_white_space().

Referenced by parseAttDef().

void dtd_processor::parseDefaultDecl ( attributeDecl decl  )  [private]

parses attribute default value [60] DefaultDecl ::= 'REQUIRED' | 'IMPLIED' | (('FIXED' S)? AttValue)

Parameters:
decl  attribute declaration

Definition at line 1005 of file dtdxml.cpp.

References attributeDecl::_atype, attributeDecl::_defval, attributeDecl::_rule, ATTR_RULE_FIXED, ATTR_RULE_IMPLIED, ATTR_RULE_REQUIRED, ATTR_TYPE_ID, ch_F, ch_I, ch_pound, ch_R, byte_manager::parseQuotedValue(), byte_manager::pick(), byte_manager::pop(), byte_manager::skip_string(), byte_manager::skip_white_space(), str_FIXED, str_IMPLIED, str_REQUIRED, and byte_manager::throw_exception().

Referenced by parseAttDef().

void dtd_processor::parsePEReference ( bool  skip_junk_before,
bool  skip_junk_after 
) [private]

parses reference [10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" [67] Reference ::= EntityRef | CharRef [68] EntityRef ::= '&' Name ';' [69] PEReference ::= '' Name ';'

Parameters:
skip_junk_before  flag to skip whitespaces before reference
skip_junk_after  flag to skip whitespaces after reference

Definition at line 1075 of file dtdxml.cpp.

References byte_manager::_tmp_store2, ch_percent, expandPEReference(), is_white_space(), paged_buffer::persist(), byte_manager::pick(), byte_manager::push(), paged_buffer::reset(), and byte_manager::skip_white_space().

Referenced by parseAttDef(), parseAttrEnumeration(), parseAttrList(), parseChildren(), parseContentSpec(), parseElement(), parseEntity(), parseEntityDef(), parseMixed(), parseNotation(), and parseSubSet().

void dtd_processor::parseNotation (  )  [private]

below parsing defined in base class [72] PEDecl ::= '<!ENTITY' S '' S Name S PEDef S? '>' [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) [74] PEDef ::= EntityValue | ExternalID [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'" [75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral [76] NDataDecl ::= S 'NDATA' S Name

parses notation [82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'

Definition at line 1047 of file dtdxml.cpp.

References byte_manager::_doc, notationDecl::_publicId, notationDecl::_systemId, byte_manager::_tmp_allocator, xml_grammar::add_notation_decl(), ch_close_angle, byte_manager::parseExternalID(), byte_manager::parseName(), parsePEReference(), byte_manager::skip_sign(), byte_manager::skip_string(), byte_manager::skip_white_space(), and str_NOTATION.

Referenced by parseSubSet().

void dtd_processor::parseInclude (  )  [private]

following parses defined in base class [83] PublicID ::= 'PUBLIC' S PubidLiteral [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) [15] Comment ::= '' [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'

[61] conditionalSect ::= includeSect | ignoreSect parse include set [62] includeSect ::= '<![' S? 'INCLUDE' S? '[' extSubsetDecl ']]>'

Definition at line 227 of file dtdxml.cpp.

References ch_close_angle, ch_close_square, ch_open_square, parseSubSet(), byte_manager::skip_sign(), byte_manager::skip_string(), and str_INCLUDE.

Referenced by parseSubSet().

dfa_token * dtd_processor::checkRepeation ( ub1_t  symbol,
dfa_token token 
) [private]

checks if the symbol is repeated

Parameters:
symbol  symbol
token  DFA token

Definition at line 394 of file dtdxml.cpp.

References byte_manager::_doc, byte_allocator::allocate(), ch_asterisk, ch_plus, ch_question, check_pointer(), DFA_ASTERISK, DFA_PLUS, DFA_QUESTION, xml_document::get_model_allocator(), and byte_manager::pop().

Referenced by parseChildren().

vt_types dtd_processor::convert_ctype ( const char *  x  )  [private]

converts CTYPE type to terimber virtual type non standard terimber extension of DTD

bool, sb1, ub1, sb2, ub2, sb4, ub4, float, double, sb8, ub8, date, string, wstring, decimal, numeric, binary, guid

Parameters:
x  input buffer

Definition at line 1125 of file dtdxml.cpp.

References ch_1, ch_2, ch_3, ch_4, ch_6, ch_8, ch_a, ch_b, ch_c, ch_d, ch_e, ch_f, ch_g, ch_i, ch_l, ch_m, ch_n, ch_o, ch_r, ch_s, ch_t, ch_u, ch_underscore, ch_v, ch_w, ch_y, byte_manager::throw_exception(), vt_binary, vt_bool, vt_date, vt_decimal, vt_double, vt_float, vt_guid, vt_numeric, vt_sb1, vt_sb2, vt_sb4, vt_sb8, vt_string, vt_ub1, vt_ub2, vt_ub4, vt_ub8, vt_unknown, and vt_wstring.

Referenced by parseAttDef().

void dtd_processor::validate (  )  [private]

validates DTD

Definition at line 1070 of file dtdxml.cpp.

Referenced by parse().

void dtd_processor::deterministic_model ( const dfa_token token  )  [private]

validates the deterministic model

Parameters:
token  DFA root token

Definition at line 1120 of file dtdxml.cpp.

Referenced by parseContentSpec().


The documentation for this class was generated from the following files:


© Copyright Terimber 2003-.