mbxmlutils
1.3.0
Multi-Body XML Utils
|
Helper class for extending DOMElement (use the function E(...)). More...
#include <dom.h>
Public Member Functions | |
DOMElementWrapper (DOMElementType *me_) | |
Wrap DOMElement to my special element. | |
FQN | getTagName () const |
Get full qualified tag name. | |
const xercesc::DOMElement * | getFirstElementChildNamed (const FQN &name) const |
Get first child element of the specified full qualified name. | |
xercesc::DOMElement * | getFirstElementChildNamed (const FQN &name) |
Get first child element of the specified full qualified name. | |
const xercesc::DOMElement * | getNextElementSiblingNamed (const FQN &name) const |
Get next sibling element of the specified full qualified name. | |
xercesc::DOMElement * | getNextElementSiblingNamed (const FQN &name) |
Get next sibling element of the specified full qualified name. | |
const xercesc::DOMProcessingInstruction * | getFirstProcessingInstructionChildNamed (const std::string &target) const |
Get first child processing instruction of the specified target. | |
xercesc::DOMProcessingInstruction * | getFirstProcessingInstructionChildNamed (const std::string &target) |
Get first child processing instruction of the specified target. | |
void | addProcessingInstructionChildNamed (const std::string &target, const std::string &data) |
Add a processing instruction child of the specified target. | |
std::string | getEmbedData (const std::string &name) const |
Get the embed data named name from the current element. Returns "" if not such data exists. | |
void | addEmbedData (const std::string &name, const std::string &data) |
const xercesc::DOMComment * | getFirstCommentChild () const |
Get first child comment. | |
xercesc::DOMComment * | getFirstCommentChild () |
Get first child comment. | |
const xercesc::DOMText * | getFirstTextChild () const |
xercesc::DOMText * | getFirstTextChild () |
template<class T > | |
T | getText (int r=0, int c=0) const |
Get the child text as type T. | |
template<class T > | |
void | addElementText (const FQN &name, const T &value) |
bool | isDerivedFrom (const FQN &baseTypeName) const |
boost::filesystem::path | getOriginalFilename (bool skipThis=false, const xercesc::DOMElement *&found=DOMElementWrapper< DOMElementType >::dummyArg) const |
void | setOriginalFilename (boost::filesystem::path orgFileName=boost::filesystem::path()) |
boost::filesystem::path | convertPath (const boost::filesystem::path &relPath) const |
int | getLineNumber () const |
int | getEmbedCountNumber () const |
void | setEmbedCountNumber (int embedCount) |
int | getEmbedXPathCount () const |
void | setEmbedXPathCount (int xPathCount) |
std::string | getRootXPathExpression () const |
std::vector< int > | getElementLocation () const |
int | getOriginalElementLineNumber () const |
Get the line number of the original element. | |
void | setOriginalElementLineNumber (int lineNr) |
Set the line number of the original element. | |
std::string | getAttribute (const FQN &name) const |
Get attribute named name. | |
FQN | getAttributeQName (const FQN &name) const |
Get attribute named name of type QName. | |
const xercesc::DOMAttr * | getAttributeNode (const FQN &name) const |
Get attribute node named name. | |
xercesc::DOMAttr * | getAttributeNode (const FQN &name) |
Get attribute node named name. | |
template<class T > | |
void | setAttribute (const FQN &name, const T &value) |
Set attribute. | |
void | setAttribute (const FQN &name, const FQN &value) |
Set attribute of type FQN. | |
bool | hasAttribute (const FQN &name) const |
check if this element has a attibute named name. | |
void | removeAttribute (const FQN &name) |
remove from this element the attibute named name. | |
std::conditional< std::is_same< DOMElementType, constxercesc::DOMElement >::value, constDOMElementWrapper *, DOMElementWrapper * >::type | operator-> () |
Treat this object as a pointer (like DOMElement*) | |
const DOMElement * | dummyArg |
const DOMElement * | dummyArg |
const xercesc::DOMElement * | dummyArg |
const xercesc::DOMElement * | dummyArg |
Static Public Attributes | |
static const xercesc::DOMElement * | dummyArg |
Private Attributes | |
DOMElementType * | me |
Helper class for extending DOMElement (use the function E(...)).
void MBXMLUtils::DOMElementWrapper< DOMElementType >::addEmbedData | ( | const std::string & | name, |
const std::string & | data | ||
) |
Add a embed data named name to the current element holding data. If the element has already such a name embedData it is overwritten with data
template path MBXMLUtils::DOMElementWrapper< DOMElementType >::convertPath | ( | const boost::filesystem::path & | relPath | ) | const |
Convert the relative path relPath to an aboslute path by prefixing it with the path of this document. If relPath is a absolute path it is returned as it. (see also getOriginalFilename)
template vector< int > MBXMLUtils::DOMElementWrapper< DOMElementType >::getElementLocation | ( | ) | const |
Get a (fast) unique location identified of this element relative to the DOMDocument. Use DOMDocumentWrapper::locateElement(...) to get the same element in another document.
template int MBXMLUtils::DOMElementWrapper< DOMElementType >::getEmbedCountNumber | ( | ) | const |
Get the embed count. If a EmbedCount processing instruction child node exist this number is returned. If not 0 is returned.
template int MBXMLUtils::DOMElementWrapper< DOMElementType >::getEmbedXPathCount | ( | ) | const |
Get the embed XPath count. If a EmbedXPathCount processing instruction child node exist this number is returned. If not 0 is returned.
DOMText * MBXMLUtils::DOMElementWrapper< DOMElementType >::getFirstTextChild |
Get first none empty child text or CDATA node. A empty text node (only spaces, tabs and new-lines) is interpreted as a formatting node not a content node. If, however, only empty text or CDATA nodes exist than the last empty text or CDATA node is returned. If no text or CDATA node or more then one none empty text or CDATA node exists nullptr is returned.
template const DOMText * MBXMLUtils::DOMElementWrapper< DOMElementType >::getFirstTextChild | ( | ) | const |
Get first none empty child text or CDATA node. A empty text node (only spaces, tabs and new-lines) is interpreted as a formatting node not a content node. If, however, only empty text or CDATA nodes exist than the last empty text or CDATA node is returned. If no text or CDATA node or more then one none empty text or CDATA node exists nullptr is returned.
template int MBXMLUtils::DOMElementWrapper< DOMElementType >::getLineNumber | ( | ) | const |
Get the line number. If a LineNr processing instruction child node exist this number is returned. If not the XML line number is returned.
template path MBXMLUtils::DOMElementWrapper< DOMElementType >::getOriginalFilename | ( | bool | skipThis = false , |
const xercesc::DOMElement *& | found = DOMElementWrapper< DOMElementType >::dummyArg |
||
) | const |
Get the base URI. Returns the value of the first OriginalFileName PI define by a parent element or the document uri if no such element is found. If skipThis is false the OriginalFileName PI of this element in honored else this element is skipped and only parent elements are honored. If a OriginalFileName PI was found 'found' is set to this element else 'found' is NULL.
template string MBXMLUtils::DOMElementWrapper< DOMElementType >::getRootXPathExpression | ( | ) | const |
Get the XPath from the root element to this element. The root element may not be the document itself if embedding has occurred. Embedding is preserved by this XPath. The output is /<root-element-name>[1]/<element-name>[<element-nr>]/<element-name>[<element-nr>] ...
template bool MBXMLUtils::DOMElementWrapper< DOMElementType >::isDerivedFrom | ( | const FQN & | baseTypeName | ) | const |
Check if the element is of type base Note DOMTypeInfo::isDerivedFrom is not implemented in xerces-c hence we define our one methode here.
void MBXMLUtils::DOMElementWrapper< DOMElementType >::setEmbedCountNumber | ( | int | embedCount | ) |
Set the embed count. Is store as a processing instruction child node.
void MBXMLUtils::DOMElementWrapper< DOMElementType >::setEmbedXPathCount | ( | int | xPathCount | ) |
Set the embed XPath count. Is store as a processing instruction child node.
void MBXMLUtils::DOMElementWrapper< DOMElementType >::setOriginalFilename | ( | boost::filesystem::path | orgFileName = boost::filesystem::path() | ) |
Set original filename. Calls getOriginalFilename on itself and set this value to itself. This function should/must be called when a element is removed from a tree but still used after that. If orgFileName is given then its different: its just the given filename set as OriginalFileName.