Home / Open source / Terimber 2.0
xml_processor Class Referencexml processor main class
More...
#include <parsexml.h>
List of all members.
|
Public Member Functions |
| xml_processor (byte_source &stream, xml_document &doc, mem_pool_t &small_pool, mem_pool_t &big_pool, size_t xml_size, bool validate) |
| consrtuctor
|
| ~xml_processor () |
| destructor
|
bool | parse () |
| parser document
|
const char * | get_error () const |
| returns the last error
|
Private Member Functions |
void | parseDocument () |
| parses document [1] document ::= prolog element Misc*
|
void | parseProlog () |
| parses prolog [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
|
void | parseDocTypeDecl () |
| parses document type declaration [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>' [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl | DeclSep)* ']' S?)? '>'
|
void | parseElement () |
| parses xml element [39] element ::= EmptyElemTag | STag content ETag
|
xml_forceinline void | parseStartTag () |
| parses xml element open tag [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' [40] STag ::= '<' Name (S Attribute)* S? '>'
|
void | parseAttributes (xml_element &el) |
| parses attributes [41] Attribute ::= Name Eq AttValue
|
xml_forceinline void | parseEndTag () |
| parses element closing tag [42] ETag ::= '</' Name S? '>'
|
xml_forceinline void | parseContent () |
| parses element content [43] content ::= CharData? ((element | Reference | CDSect | PI | Comment) CharData?)*
|
void | parseCDATA () |
| CDATA section [18] CDSect ::= CDStart CData CDEnd [19] CDStart ::= '<![CDATA[' [20] CData ::= (Char* - (Char* ']]>' Char*)) [21] CDEnd ::= ']]>'.
|
void | _parseCharData () |
| parses char data - text node, internal version
|
xml_forceinline void | parseCharData () |
| parses char data - text node inline wrapper
|
void | parseGeneralReference (bool skip_after) |
| parses general reference [67] Reference ::= EntityRef | CharRef [68] EntityRef ::= '&' Name ';' [66] CharRef ::= '&#' [0-9]+ ';' | '&x' [0-9a-fA-F]+ ';'
|
void | parseMisc () |
| parses misc [27] Misc ::= Comment | PI | S
|
void | parseDTD (const char *location=0) |
| parses DTD
|
void | skipDTD () |
| parses DTD but does not build grammar
|
void | resolve_references () |
| resolves references
|
Private Attributes |
xml_document & | _doc |
| xml document
|
bool | _preserve_white_space |
| flag to preserve white spaces
|
byte_allocator * | _white_space_allocator |
| white space stack allocator
|
xml_white_space_stack_t | _white_space_stack |
| white space stack
|
string_t | _error |
| last error
|
bool | _validate |
| flag to do validation
|
Detailed Description
xml processor main class
Definition at line 61 of file parsexml.h.
Constructor & Destructor Documentation
xml_processor::~xml_processor |
( |
|
) |
|
Member Function Documentation
bool xml_processor::parse |
( |
|
) |
|
parser document
Definition at line 77 of file parsexml.cpp.
References _doc, byte_manager::_entity_allocator, byte_manager::_entity_map, _error, _preserve_white_space, _white_space_allocator, _white_space_stack, xml_document::add_escaped_symbols(), base_map< K, T, Pr, M >::clear(), base_stack< T >::clear(), xml_document::container_reset(), parseDocument(), byte_manager::pick(), byte_allocator::reset(), resolve_references(), byte_manager::skip_white_space(), byte_manager::throw_exception(), and exception::what().
Referenced by xml_designer_impl::_load().
const char * xml_processor::get_error |
( |
|
) |
const |
void xml_processor::parseDocument |
( |
|
) |
[private] |
parses document [1] document ::= prolog element Misc*
Definition at line 122 of file parsexml.cpp.
References xml_node::_decl, _doc, xml_document::_standalone, xml_document::container_peak(), xml_document::get_root_element(), byte_manager::get_standalone(), os_minus_one, parseElement(), parseMisc(), parseProlog(), and byte_manager::throw_exception().
Referenced by parse().
void xml_processor::parseProlog |
( |
|
) |
[private] |
parses prolog [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
Definition at line 144 of file parsexml.cpp.
References _doc, ch_bang, ch_D, ch_dash, ch_open_angle, ch_question, xml_document::get_tmp_allocator(), byte_manager::parseComment(), parseDocTypeDecl(), byte_manager::parsePI(), byte_manager::pick(), byte_manager::pop(), byte_manager::push(), byte_allocator::reset(), byte_manager::reset_all_tmp(), and byte_manager::skip_white_space().
Referenced by parseDocument().
void xml_processor::parseDocTypeDecl |
( |
|
) |
[private] |
parses document type declaration [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>' [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl | DeclSep)* ']' S?)? '>'
Definition at line 194 of file parsexml.cpp.
References _doc, xml_grammar::_public_id, xml_document::_standalone, xml_grammar::_system_id, ch_close_angle, ch_open_square, ch_P, ch_S, xml_document::check_root(), xml_document::container_start_doctype(), xml_document::container_stop_doctype(), byte_manager::get_standalone(), xml_document::is_on_fly(), base_string< T >::length(), os_minus_one, parseDTD(), byte_manager::parseExternalID(), byte_manager::parseName(), byte_manager::pick(), byte_manager::pop(), xml_document::set_doc_name(), byte_manager::skip_sign(), byte_manager::skip_string(), byte_manager::skip_white_space(), skipDTD(), str_DOCTYPE, and byte_manager::throw_exception().
Referenced by parseProlog().
void xml_processor::parseElement |
( |
|
) |
[private] |
parses xml element [39] element ::= EmptyElemTag | STag content ETag
Definition at line 281 of file parsexml.cpp.
References _doc, ch_ampersand, ch_forward_slash, ch_open_angle, xml_document::container_peak(), xml_document::get_tmp_allocator(), parseContent(), parseEndTag(), parseGeneralReference(), parseStartTag(), byte_manager::pick(), byte_manager::pop(), byte_allocator::reset(), byte_manager::reset_all_tmp(), and byte_manager::skip_white_space().
Referenced by parseDocument().
BEGIN_TERIMBER_NAMESPACE xml_forceinline void xml_processor::parseStartTag |
( |
|
) |
[private] |
parses xml element open tag [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' [40] STag ::= '<' Name (S Attribute)* S? '>'
Definition at line 43 of file parsexml.hpp.
References _doc, xml_white_space_handler::_el, xml_white_space_handler::_preserve, _preserve_white_space, _validate, _white_space_allocator, _white_space_stack, xml_document::add_element(), ch_ampersand, ch_close_angle, ch_forward_slash, xml_document::container_push(), base_stack< T >::empty(), parseAttributes(), parseGeneralReference(), byte_manager::parseName(), byte_manager::pick(), _stack< T, A >::pop(), byte_manager::pop(), byte_allocator::reset(), byte_manager::skip_sign(), byte_manager::throw_exception(), base_stack< T >::top(), and xml_document::validate().
Referenced by parseElement().
void xml_processor::parseAttributes |
( |
xml_element & |
el |
) |
[private] |
parses attributes [41] Attribute ::= Name Eq AttValue
- Parameters:
-
Definition at line 319 of file parsexml.cpp.
References elementDecl::_attributes, _doc, attributeDecl::_enum, _preserve_white_space, byte_manager::_tmp_allocator, _white_space_allocator, _white_space_stack, xml_document::add_attribute(), xml_document::add_def_attributes(), base_list< T >::begin(), base_map< K, T, Pr, M >::begin(), xml_element::cast_decl(), xml_node::cast_to_attribute(), ch_ampersand, ch_close_angle, ch_forward_slash, base_map< size_t, attributeDecl, less< size_t >, M >::const_iterator, base_list< T >::end(), base_map< K, T, Pr, M >::end(), base_map< K, T, Pr, M >::find(), xml_grammar::find_attribute_decl(), _map< K, T, A, Pr, M >::insert(), xml_document::is_on_fly(), byte_manager::parseAttributeValue(), parseGeneralReference(), byte_manager::pick(), _stack< T, A >::push(), base_map< K, T, Pr, M >::size(), byte_manager::skip_white_space(), str_preserve, str_xml_space, and byte_manager::throw_exception().
Referenced by parseStartTag().
xml_forceinline void xml_processor::parseEndTag |
( |
|
) |
[private] |
parses element closing tag [42] ETag ::= '</' Name S? '>'
Definition at line 91 of file parsexml.hpp.
References xml_node::_decl, _doc, xml_white_space_handler::_el, namedNode::_name, xml_white_space_handler::_preserve, _preserve_white_space, _validate, _white_space_allocator, _white_space_stack, ch_close_angle, xml_document::container_pop(), base_stack< T >::empty(), byte_manager::parseName(), _stack< T, A >::pop(), byte_allocator::reset(), byte_manager::skip_sign(), byte_manager::throw_exception(), base_stack< T >::top(), and xml_document::validate().
Referenced by parseElement().
xml_forceinline void xml_processor::parseContent |
( |
|
) |
[private] |
parses element content [43] content ::= CharData? ((element | Reference | CDSect | PI | Comment) CharData?)*
Definition at line 119 of file parsexml.hpp.
References ch_ampersand, ch_bang, ch_dash, ch_open_angle, ch_open_square, ch_question, parseCDATA(), parseCharData(), byte_manager::parseComment(), byte_manager::parsePI(), byte_manager::pick(), byte_manager::pop(), byte_manager::push(), byte_manager::reset_all_tmp(), and byte_manager::throw_exception().
Referenced by parseElement().
void xml_processor::parseCDATA |
( |
|
) |
[private] |
CDATA section [18] CDSect ::= CDStart CData CDEnd [19] CDStart ::= '<![CDATA[' [20] CData ::= (Char* - (Char* ']]>' Char*)) [21] CDEnd ::= ']]>'.
Definition at line 392 of file parsexml.cpp.
References _doc, byte_manager::_tmp_store1, xml_document::add_cdata(), ch_close_angle, ch_close_square, ch_open_square, paged_buffer::persist(), byte_manager::pick(), byte_manager::pop(), paged_buffer::reset(), byte_manager::skip_sign(), byte_manager::skip_string(), str_CDATA, and byte_manager::throw_exception().
Referenced by parseContent().
void xml_processor::_parseCharData |
( |
|
) |
[private] |
parses char data - text node, internal version
Definition at line 434 of file parsexml.cpp.
References _doc, _preserve_white_space, byte_manager::_tmp_store1, byte_manager::_tmp_store2, byte_manager::_tmp_store3, xml_document::add_text(), ch_ampersand, ch_close_angle, ch_close_square, ch_open_angle, is_white_space(), paged_buffer::persist(), byte_manager::pick(), byte_manager::pop(), byte_manager::push(), paged_buffer::reset(), byte_manager::reset_all_tmp(), byte_manager::resolveEntity(), paged_buffer::size(), and byte_manager::throw_exception().
Referenced by parseCharData().
xml_forceinline void xml_processor::parseCharData |
( |
|
) |
[private] |
void xml_processor::parseGeneralReference |
( |
bool |
skip_after |
) |
[private] |
void xml_processor::parseMisc |
( |
|
) |
[private] |
parses misc [27] Misc ::= Comment | PI | S
Definition at line 249 of file parsexml.cpp.
References _doc, ch_bang, ch_dash, ch_open_angle, ch_question, xml_document::get_tmp_allocator(), byte_manager::parseComment(), byte_manager::parsePI(), byte_manager::pick(), byte_manager::pop(), byte_allocator::reset(), byte_manager::reset_all_tmp(), byte_manager::skip_white_space(), and byte_manager::throw_exception().
Referenced by parseDocument().
void xml_processor::parseDTD |
( |
const char * |
location = 0 |
) |
[private] |
parses DTD
- Parameters:
-
location |
optional external location |
Definition at line 528 of file parsexml.cpp.
References byte_manager::_big_pool, _doc, byte_manager::_small_pool, byte_manager::_stream, exception::_throw(), byte_manager::_tmp_allocator, byte_manager::_xml_size, stream_input_common::close(), xml_stream_attribute::complete_to_full(), byte_source::get_location(), stream_input_common::open(), dtd_processor::parse(), and byte_manager::pop().
Referenced by parseDocTypeDecl().
void xml_processor::skipDTD |
( |
|
) |
[private] |
void xml_processor::resolve_references |
( |
|
) |
[private] |
Member Data Documentation
xml document
Reimplemented from byte_manager.
Definition at line 159 of file parsexml.h.
Referenced by _parseCharData(), parse(), parseAttributes(), parseCDATA(), parseDocTypeDecl(), parseDocument(), parseDTD(), parseElement(), parseEndTag(), parseMisc(), parseProlog(), parseStartTag(), and resolve_references().
The documentation for this class was generated from the following files:
|
|