mbxmlutils  1.3.0
Multi-Body XML Utils
MBXMLUtils::DOMParser Class Reference

A XML DOM parser. More...

#include <dom.h>

Inheritance diagram for MBXMLUtils::DOMParser:
[legend]

Public Member Functions

std::shared_ptr< xercesc::DOMDocument > parse (const boost::filesystem::path &inputSource, std::vector< boost::filesystem::path > *dependencies=nullptr, bool doXInclude=true)
 
std::shared_ptr< xercesc::DOMDocument > parse (std::istream &inputStream, std::vector< boost::filesystem::path > *dependencies=nullptr, bool doXInclude=true)
 
xercesc::DOMElement * parseWithContext (const std::string &str, xercesc::DOMNode *contextNode, xercesc::DOMLSParser::ActionType action, std::vector< boost::filesystem::path > *dependencies=nullptr, bool doXInclude=true)
 
void resetCachedGrammarPool ()
 reset all loaded grammars
 
std::shared_ptr< xercesc::DOMDocument > createDocument ()
 create a empty document
 
const std::map< FQN, xercesc::XSTypeDefinition * > & getTypeMap () const
 

Static Public Member Functions

static std::shared_ptr< DOMParsercreate (const std::variant< boost::filesystem::path, xercesc::DOMElement * > &xmlCatalog=static_cast< xercesc::DOMElement * >(nullptr))
 
static void serialize (xercesc::DOMNode *n, const boost::filesystem::path &outputSource)
 
static void serializeToString (xercesc::DOMNode *n, std::string &outputData)
 

Private Member Functions

 DOMParser (const std::variant< boost::filesystem::path, xercesc::DOMElement * > &xmlCatalog)
 

Static Private Member Functions

static void handleXInclude (xercesc::DOMElement *&e, std::vector< boost::filesystem::path > *dependencies)
 

Private Attributes

xercesc::DOMImplementation * domImpl
 
std::shared_ptr< xercesc::DOMLSParser > parser
 
std::map< FQN, xercesc::XSTypeDefinition * > typeMap
 
DOMErrorPrinter errorHandler
 
LocationInfoFilter locationFilter
 
TypeDerivativeHandler typeDerHandler
 
EntityResolver entityResolver
 
std::map< std::string, boost::filesystem::path > registeredGrammar
 

Friends

class TypeDerivativeHandler
 
class LocationInfoFilter
 
class UserDataHandler
 
class EntityResolver
 
class DOMElementWrapper< xercesc::DOMElement >
 
class DOMElementWrapper< const xercesc::DOMElement >
 
template<typename >
class DOMDocumentWrapper
 

Detailed Description

A XML DOM parser.

Member Function Documentation

◆ create()

shared_ptr< DOMParser > MBXMLUtils::DOMParser::create ( const std::variant< boost::filesystem::path, xercesc::DOMElement * > &  xmlCatalog = static_cast<xercesc::DOMElement*>(nullptr))
static

Create DOM parser A none validating parser if xmlCatalog is empty or a nullptr. A validating parser if xmlCatalog defines a XML catalog file or a root XML element of a catalog

◆ parse() [1/2]

std::shared_ptr< xercesc::DOMDocument > MBXMLUtils::DOMParser::parse ( const boost::filesystem::path &  inputSource,
std::vector< boost::filesystem::path > *  dependencies = nullptr,
bool  doXInclude = true 
)

Parse a XML document from a filename. Track file dependencies if dependencies is not null. Allow XML XInclude if doXInclude is true.

◆ parse() [2/2]

std::shared_ptr< xercesc::DOMDocument > MBXMLUtils::DOMParser::parse ( std::istream &  inputStream,
std::vector< boost::filesystem::path > *  dependencies = nullptr,
bool  doXInclude = true 
)

Parse a XML document from a input stream. Track file dependencies if dependencies is not null. Allow XML XInclude if doXInclude is true.

◆ parseWithContext()

DOMElement * MBXMLUtils::DOMParser::parseWithContext ( const std::string &  str,
xercesc::DOMNode *  contextNode,
xercesc::DOMLSParser::ActionType  action,
std::vector< boost::filesystem::path > *  dependencies = nullptr,
bool  doXInclude = true 
)

Parse a XML document from a istream to a given context. Track file dependencies if dependencies is not null. Allow XML XInclude if doXInclude is true.

◆ serialize()

void MBXMLUtils::DOMParser::serialize ( xercesc::DOMNode *  n,
const boost::filesystem::path &  outputSource 
)
static

Serialize a document to a file. Helper function to write a node.

◆ serializeToString()

void MBXMLUtils::DOMParser::serializeToString ( xercesc::DOMNode *  n,
std::string &  outputData 
)
static

Serialize a document to a memory (std::string). Helper function to write a node.


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