mbxmlutils  1.3.0
Multi-Body XML Utils
MBXMLUtils::DOMDocumentWrapper< DOMDocumentType > Class Template Reference

Helper class for extending DOMDocument (use the function D(...)). More...

#include <dom.h>

Public Member Functions

 DOMDocumentWrapper (DOMDocumentType *me_)
 Wrap DOMDocument to my special element.
 
XercesUniquePtr< xercesc::DOMElement > validate ()
 
xercesc::DOMElement * createElement (const FQN &name)
 
std::shared_ptr< DOMParsergetParser () const
 Get full qualified tag name.
 
boost::filesystem::path getDocumentFilename () const
 
xercesc::DOMNode * evalRootXPathExpression (std::string xpathExpression, xercesc::DOMElement *context=nullptr)
 
xercesc::DOMElement * locateElement (const std::vector< int > &idx) const
 
std::conditional< std::is_same< DOMDocumentType, constxercesc::DOMDocument >::value, constDOMDocumentWrapper *, DOMDocumentWrapper * >::type operator-> ()
 Treat this object as a pointer (like DOMDocument*)
 

Private Attributes

DOMDocumentType * me
 

Detailed Description

template<typename DOMDocumentType>
class MBXMLUtils::DOMDocumentWrapper< DOMDocumentType >

Helper class for extending DOMDocument (use the function D(...)).

Member Function Documentation

◆ createElement()

template<typename DOMDocumentType >
xercesc::DOMElement * MBXMLUtils::DOMDocumentWrapper< DOMDocumentType >::createElement ( const FQN name)

create element with the given FQN Note: a empty namespace (name.first.empty()==true) as no namespace

◆ evalRootXPathExpression()

template<typename DOMDocumentType >
DOMNode * MBXMLUtils::DOMDocumentWrapper< DOMDocumentType >::evalRootXPathExpression ( std::string  xpathExpression,
xercesc::DOMElement *  context = nullptr 
)

Get the node (DOMElement or DOMAttrType) corresponding the given xpathExpression relative to the root. If context is nullptr than the root element is used. Only a very small subset of XPath is supported by this function: the output of getRootXPathExpression

◆ getDocumentFilename()

template<typename DOMDocumentType >
template path MBXMLUtils::DOMDocumentWrapper< DOMDocumentType >::getDocumentFilename ( ) const

Get the filename of the document. This is the same as getDocumentURI but with the file schema removed and is a relative path if it was read by a relative path

◆ locateElement()

template<typename DOMDocumentType >
DOMElement * MBXMLUtils::DOMDocumentWrapper< DOMDocumentType >::locateElement ( const std::vector< int > &  idx) const

Get the element in this document which corresponds to the location idx. idx is usualy retrieved via DOMElementWrapper::getElementLocation().

◆ validate()

template<typename DOMDocumentType >
XercesUniquePtr< DOMElement > MBXMLUtils::DOMDocumentWrapper< DOMDocumentType >::validate

(re)validate the document using the parser this document was created This will renew ALL nodes in the document. But the old root DOMElement, including all old childrens, will be returned. If you don't use the return value it will be released automatically.


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