From 884dea7531962b17ef843ac2175faa050e8b0758 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 Apr 2014 12:57:06 +0200 Subject: Add support for ordered types, mixed content --- libxsd/xsd/cxx/xml/dom/parsing-source.hxx | 33 +++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'libxsd/xsd/cxx/xml/dom/parsing-source.hxx') diff --git a/libxsd/xsd/cxx/xml/dom/parsing-source.hxx b/libxsd/xsd/cxx/xml/dom/parsing-source.hxx index 1c53928..fac1006 100644 --- a/libxsd/xsd/cxx/xml/dom/parsing-source.hxx +++ b/libxsd/xsd/cxx/xml/dom/parsing-source.hxx @@ -30,30 +30,47 @@ namespace xsd { namespace dom { - // Parser state object. Can be used for parsing element, attributes, - // or both. + // Parser state object. Can be used for parsing elements (and + // optionally text), attributes, or both. // template class parser { public: - parser (const xercesc::DOMElement& e, bool ep, bool ap); + parser (const xercesc::DOMElement& e, bool ep, bool tp, bool ap); + // Content parsing. + // bool - more_elements () + more_content () { - return next_element_ != 0; + return next_content_ != 0; } const xercesc::DOMElement& cur_element () { - return *static_cast (next_element_); + return *static_cast (next_content_); + } + + const xercesc::DOMText& + cur_text () + { + return *static_cast (next_content_); + } + + bool + cur_is_text () + { + return next_content_->getNodeType () != + xercesc::DOMNode::ELEMENT_NODE; } void - next_element (); + next_content (bool text); + // Attribute parsing. + // bool more_attributes () { @@ -86,7 +103,7 @@ namespace xsd private: const xercesc::DOMElement& element_; - const xercesc::DOMNode* next_element_; + const xercesc::DOMNode* next_content_; const xercesc::DOMNamedNodeMap* a_; XMLSize_t ai_; // Index of the next DOMAttr. -- cgit v1.1