tdaq-develop-2025-02-12
ots::XmlDocument Class Reference
Inheritance diagram for ots::XmlDocument:
ots::HttpXmlDocument

Public Member Functions

 XmlDocument (const std::string &rootName="ROOT")
 
 XmlDocument (const XmlDocument &doc)
 
XmlDocumentoperator= (const XmlDocument &doc)
 
xercesc::DOMElement * addTextElementToParent (const std::string &childName, const std::string &childText, xercesc::DOMElement *parent)
 
xercesc::DOMElement * addTextElementToParent (const std::string &childName, const std::string &childText, const std::string &parentName, unsigned int parentIndex=0)
 
void saveXmlDocument (const std::string &filePath)
 
void recursiveRemoveChild (xercesc::DOMElement *childEl, xercesc::DOMElement *parentEl)
 
bool loadXmlDocument (const std::string &filePath)
 
void outputXmlDocument (std::ostringstream *out, bool dispStdOut=false)
 
void makeDirectoryBinaryTree (const std::string &name, const std::string &rootPath, int indent, xercesc::DOMElement *anchorNode)
 
xercesc::DOMElement * populateBinaryTreeNode (xercesc::DOMElement *anchorNode, const std::string &name, int indent, bool isLeaf)
 
void setAnchors (const std::string &fSystemPath, const std::string &fRootPath)
 
void setDocument (xercesc::DOMDocument *doc)
 
void setDarioStyle (bool darioStyle)
 
void setRootPath (const std::string &rootPath)
 

Protected Member Functions

void copyDocument (const xercesc::DOMDocument *toCopy, xercesc::DOMDocument *copy)
 
void recursiveElementCopy (const xercesc::DOMElement *toCopy, xercesc::DOMElement *copy)
 
void initDocument (void)
 
void initPlatform (void)
 
void terminatePlatform (void)
 
void recursiveOutputXmlDocument (xercesc::DOMElement *currEl, std::ostringstream *out, bool dispStdOut=false, const std::string &tabStr="")
 

Protected Attributes

xercesc::DOMImplementation * theImplementation_
 
xercesc::DOMDocument * theDocument_
 
xercesc::DOMElement * rootElement_
 
const std::string rootTagName_
 
xercesc::DOMDocument * doc
 
xercesc::DOMElement * rootElem
 
DIR * dir
 
struct dirent * entry
 
int lastIndent
 
int errorCode
 
int level
 
std::string fullPath
 
std::string fullFPath
 
std::stringstream ss_
 
std::map< int, xercesc::DOMElement * > theNodes_
 
std::map< int, std::string > theNames_
 
std::vector< std::string > hierarchyPaths_
 
xercesc::DOMImplementation * impl
 
xercesc::DOMLSSerializer * pSerializer
 
xercesc::DOMConfiguration * pDomConfiguration
 
bool darioXMLStyle_
 
std::string fSystemPath_
 
std::string fRootPath_
 
std::string fFoldersPath_
 
std::string fFileName_
 
std::string fThisFolderPath_
 
int indent_
 
std::map< bool, std::string > isALeaf_
 

Detailed Description

Definition at line 34 of file XmlDocument.h.

Constructor & Destructor Documentation

◆ XmlDocument()

XmlDocument::XmlDocument ( const std::string &  rootName = "ROOT")

Definition at line 46 of file XmlDocument.cc.

Member Function Documentation

◆ addTextElementToParent() [1/2]

xercesc::DOMElement * XmlDocument::addTextElementToParent ( const std::string &  childName,
const std::string &  childText,
const std::string &  parentName,
unsigned int  parentIndex = 0 
)

addTextElementToParent add to parent by instance number of parent name returns pointer to element that is added

Definition at line 237 of file XmlDocument.cc.

◆ addTextElementToParent() [2/2]

xercesc::DOMElement * XmlDocument::addTextElementToParent ( const std::string &  childName,
const std::string &  childText,
xercesc::DOMElement *  parent 
)

addTextElementToParent add to parent by pointer to parent returns pointer to element that is added

Definition at line 190 of file XmlDocument.cc.

◆ copyDocument()

void XmlDocument::copyDocument ( const xercesc::DOMDocument *  toCopy,
xercesc::DOMDocument *  copy 
)
protected

Definition at line 257 of file XmlDocument.cc.

◆ outputXmlDocument()

void XmlDocument::outputXmlDocument ( std::ostringstream *  out,
bool  dispStdOut = false 
)

XmlDocument::addElementToParent Add field/value element to XML doc at parent On Success, The child index of the added element with respect to the parent is returned and can be used to add children to the new element On Failure, return -1 XmlDocument::addDataElement Add field/value element to XML doc at parent which is returned from getElementsByTagName(parentName), entry number parentNameIndex On Success, The child index of the added element with respect to the parent is returned and can be used to add children to the new element On Failure, return -1 XmlDocument::addDataElement Add field/value element to XML doc at parentIndexArray (with depth of parent indicated by parentIndexArraySize) If parentIndexArray = NULL, element is added with <DATA> parent otherwise, parentIndexArray indicates the parent within the node list for DATA> where the element will be added On Success, The child index of the added element with respect to the parent is returned and can be used to add children to the new element On Failure, return -1 XmlDocument::addXmlData Append <DATA> from xmldoc to this XML doc On Success, The child index within <DATA> of the first element is returned On Failure, return -1 XmlDocument::recursiveAddElementToParent add currEl and its children tree to parentEl XmlDocument::outputXmlDocument recurse through XML theDocument_ and std out and output to stream parameter if not null

Definition at line 471 of file XmlDocument.cc.

◆ recursiveOutputXmlDocument()

void XmlDocument::recursiveOutputXmlDocument ( xercesc::DOMElement *  currEl,
std::ostringstream *  out,
bool  dispStdOut = false,
const std::string &  tabStr = "" 
)
protected

XmlDocument::recursiveOutputXmlDocument recursively printout XML theDocument_ to std out and output stream if not null

Definition at line 481 of file XmlDocument.cc.

◆ recursiveRemoveChild()

void XmlDocument::recursiveRemoveChild ( xercesc::DOMElement *  childEl,
xercesc::DOMElement *  parentEl 
)

XmlDocument::getDataElement returns the value for field found occurance number of times returns empty std::string "" if field was not found XmlDocument::recursiveFindElement recursively searches and returns the value for field found occurance number of times XmlDocument::getAllDataElements returns all of the values found for the field in a vector if none found vector will have size 0 XmlDocument::recursiveFindElement recursively searches and returns the value for field found occurance number of times XmlDocument::recursiveRemoveChild remove child and all of child's sub-tree from parent

Definition at line 632 of file XmlDocument.cc.

◆ saveXmlDocument()

void XmlDocument::saveXmlDocument ( const std::string &  filePath)

XmlDocument::saveXmlDocument wrapper for private outputXML Warning: filePath must be accessible or program will crash!

Definition at line 652 of file XmlDocument.cc.


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