mbxmlutils  1.3.0
Multi-Body XML Utils
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
MBXMLUtils::DOMElementWrapper< DOMElementType > Class Template Reference

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.
 
const xercesc::DOMText * getFirstTextChild () const
 Get first child text.
 
xercesc::DOMText * getFirstTextChild ()
 Get first child text.
 
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 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
 
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.
 
void workaroundDefaultAttributesOnImportNode ()
 Workaround: convert default attributes to normal attributes (must be used before importNode to also import default attributes)
 
std::conditional< std::is_same< DOMElementType, const xercesc::DOMElement >::value, const DOMElementWrapper *, DOMElementWrapper * >::type operator-> ()
 Treat this object as a pointer (like DOMElement*)
 
template<>
const DOMElement * dummyArg
 
template<>
const DOMElement * dummyArg
 
template<>
const xercesc::DOMElement * dummyArg
 
template<>
const xercesc::DOMElement * dummyArg
 

Static Public Attributes

static const xercesc::DOMElement * dummyArg
 

Private Attributes

DOMElementType * me
 

Detailed Description

template<typename DOMElementType>
class MBXMLUtils::DOMElementWrapper< DOMElementType >

Helper class for extending DOMElement (use the function E(...)).

Member Function Documentation

◆ convertPath()

template<typename DOMElementType>
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)

◆ getEmbedCountNumber()

template<typename DOMElementType >
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.

◆ getEmbedXPathCount()

template<typename DOMElementType >
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.

◆ getLineNumber()

template<typename DOMElementType >
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.

◆ getOriginalFilename()

template<typename DOMElementType>
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.

◆ getRootXPathExpression()

template<typename DOMElementType >
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 occured.

◆ isDerivedFrom()

template<typename DOMElementType >
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.

◆ setEmbedCountNumber()

template<typename DOMElementType >
void MBXMLUtils::DOMElementWrapper< DOMElementType >::setEmbedCountNumber ( int  embedCount)

Set the embed count. Is store as a processing instruction child node.

◆ setEmbedXPathCount()

template<typename DOMElementType >
void MBXMLUtils::DOMElementWrapper< DOMElementType >::setEmbedXPathCount ( int  xPathCount)

Set the embed XPath count. Is store as a processing instruction child node.

◆ setOriginalFilename()

template<typename DOMElementType >
void MBXMLUtils::DOMElementWrapper< DOMElementType >::setOriginalFilename ( )

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.


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