From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- libxsd/xsd/cxx/xml/dom/parsing-source.hxx | 138 ++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 libxsd/xsd/cxx/xml/dom/parsing-source.hxx (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 new file mode 100644 index 0000000..b6abd58 --- /dev/null +++ b/libxsd/xsd/cxx/xml/dom/parsing-source.hxx @@ -0,0 +1,138 @@ +// file : xsd/cxx/xml/dom/parsing-source.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_CXX_XML_DOM_PARSING_SOURCE_HXX +#define XSD_CXX_XML_DOM_PARSING_SOURCE_HXX + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include // properies +#include + +#include +#include // name +#include + +namespace xsd +{ + namespace cxx + { + namespace xml + { + namespace dom + { + // Parser state object. Can be used for parsing element, attributes, + // or both. + // + template + class parser + { + public: + parser (const xercesc::DOMElement& e, bool ep, bool ap); + + bool + more_elements () + { + return next_element_ != 0; + } + + const xercesc::DOMElement& + cur_element () + { + return *static_cast (next_element_); + } + + void + next_element (); + + bool + more_attributes () + { + return as_ > ai_; + } + + const xercesc::DOMAttr& + next_attribute () + { + return *static_cast (a_->item (ai_++)); + } + + void + reset_attributes () + { + ai_ = 0; + } + + const xercesc::DOMElement& + element () const + { + return element_; + } + + private: + parser (const parser&); + + parser& + operator= (const parser&); + + private: + const xercesc::DOMElement& element_; + const xercesc::DOMNode* next_element_; + + const xercesc::DOMNamedNodeMap* a_; + XMLSize_t ai_; // Index of the next DOMAttr. + XMLSize_t as_; // Cached size of a_. + }; + + + // Parsing flags. + // + const unsigned long dont_validate = 0x00000400UL; + const unsigned long no_muliple_imports = 0x00000800UL; + + template + xml::dom::auto_ptr + parse (xercesc::InputSource&, + error_handler&, + const properties&, + unsigned long flags); + + template + xml::dom::auto_ptr + parse (xercesc::InputSource&, + xercesc::DOMErrorHandler&, + const properties&, + unsigned long flags); + + template + xml::dom::auto_ptr + parse (const std::basic_string& uri, + error_handler&, + const properties&, + unsigned long flags); + + template + xml::dom::auto_ptr + parse (const std::basic_string& uri, + xercesc::DOMErrorHandler&, + const properties&, + unsigned long flags); + } + } + } +} + +#include + +#endif // XSD_CXX_XML_DOM_PARSING_SOURCE_HXX -- cgit v1.1