ADTF
|
cDOM implements a XML parser which can be used to read in XML files and perform simple (!) queries. More...
Public Member Functions | |
A_UTILS_DEPRECATED() | cDOM () |
Default constructor. More... | |
virtual | ~cDOM () |
Destructor. | |
A_UTILS_DEPRECATED() | cDOM (const cDOM &oDOM) |
Copy constructor. More... | |
cDOM & | operator= (const cDOM &oDOM) |
Copy assignment operator. More... | |
tResult | Load (const tChar *strFilename, const tBool &bIgnoreIncludes=tFalse, const tUInt32 &ui32OpenMode=cFile::OM_Read|cFile::OM_SharedRead|cFile::OM_SequentialAccess) |
Loads an xml file and creates the dom. More... | |
tResult | Save (const tChar *strFilename, const tBool &bKeepIncludes=tFalse) const |
Save dom to an xml file. More... | |
tResult | FromString (const tChar *ptrXML, const tBool &bIgnoreIncludes=tFalse) |
Create the dom from an input string. More... | |
cString | ToString () const |
Creates an xml string representation of the dom. More... | |
tResult | Free () |
Frees all allocated resources. More... | |
cDOMElement & | GetRoot () |
Returns the root element of the dom. More... | |
const cDOMElement & | GetRoot () const |
Returns the root element of the dom. More... | |
tVoid | SetRoot (const cDOMElement &oNewRoot) |
Set the root element of the dom. More... | |
tVoid | AddPreRootSibling (const cDOMElement &oChild) |
For internal use only. | |
tVoid | AddPostRootSibling (const cDOMElement &oChild) |
For internal use only. | |
const cDOMElementList & | GetPreRootSibling () const |
For internal use only. | |
const cDOMElementList & | GetPostRootSibling () const |
For internal use only. | |
tResult | FindNode (const tChar *strQuery, cDOMElement *&poElement) |
Finds a node based on a query, see cDOMElement::FindNode. More... | |
tResult | FindNodes (const tChar *strQuery, cDOMElementRefList &lstElements) |
Finds nodes based on a query, see cDOMElement::FindNode. More... | |
cString | GetFilePath () |
Returns the name of the file that the dom was created from. More... | |
cStringList | GetIncludedFiles () |
Returns a list of files that are included in the loaded file. More... | |
tVoid | AddIncludedFile (const cString &strIncludedFile) |
Adds an include file statement to the dom. More... | |
cString | GetLastDOMError () |
Returns the last error description occurred. More... | |
Static Public Member Functions | |
static tResult | SkipComment (cDOM *pDom, const tChar *&ptr, std::list< cString > &lstComment, const tChar *pStart=nullptr) |
Skips xml comment sections in a string. More... | |
Protected Attributes | |
cFilename | m_strFilePath |
path of xml file | |
cDOMElement | m_oRoot |
root element of dom | |
cDOMElementList | m_lstPreRootSibling |
pre root siblings | |
cDOMElementList | m_lstPostRootSibling |
post root siblings | |
cStringList | m_lstIncludedFile |
list of included files | |
tBool | m_bIgnoreIncludesEnabled |
special tag include is enabled or not | |
cString | m_strLastErrorDescription |
if error occurs this will hold the parser error description | |
Static Protected Attributes | |
static const tSize | m_nTABSIZE = 1 |
TAB Size for IndentLevel. | |
Private Member Functions | |
tResult | DropIncludes (cDOMElement *pElement=nullptr) |
tVoid | SetDOMError (cString &strError) |
tBool | IsIgnoreIncludesEnabled () |
Static Private Member Functions | |
static tVoid | DOMError (cDOM *pDom, const tChar *pStart, const tChar *pCur, const tChar *pMsg) |
cDOM implements a XML parser which can be used to read in XML files and perform simple (!) queries.
It does neither support any specific XML standard nor is it intended to support any standards in future releases! You should include other XML libraries (e.g. MSXML or TinyXml) if you need specific functions that are not implemented in cDOM.
cDOM does not perform complete XML validation, so make sure that only valid XML files are used as input.
Actually the "encoding" is ignored! So if there are characters which are NOT ASCII-Format then the result can be strange!
Definition at line 458 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/std/dom.h.
A_UTILS_DEPRECATED() cDOM | ( | ) |
Default constructor.
A_UTILS_DEPRECATED() cDOM | ( | const cDOM & | oDOM | ) |
Copy constructor.
oDOM | [in] The object to copy. |
Adds an include file statement to the dom.
Included files have to be encapsulated by a root node which is omitted on including.
strIncludedFile | [in] The file to include. |
tResult FindNode | ( | const tChar * | strQuery, |
cDOMElement *& | poElement | ||
) |
Finds a node based on a query, see cDOMElement::FindNode.
See cDOMElement::FindNode for the syntax.
strQuery | [in] The query string. |
poElement | [out] This will point to the found element. |
tResult FindNodes | ( | const tChar * | strQuery, |
cDOMElementRefList & | lstElements | ||
) |
Finds nodes based on a query, see cDOMElement::FindNode.
See cDOMElement::FindNode for the syntax.
strQuery | [in] The query string. |
lstElements | [out] This list will be filled with the found elements. |
tResult Free | ( | ) |
Frees all allocated resources.
Create the dom from an input string.
ptrXML | [in] The string. |
bIgnoreIncludes | [in] the special tag 'include' will be ignored! |
ERR_UNEXPECTED | Invalid XML tag |
cString GetFilePath | ( | ) |
Returns the name of the file that the dom was created from.
cStringList GetIncludedFiles | ( | ) |
Returns a list of files that are included in the loaded file.
cString GetLastDOMError | ( | ) |
Returns the last error description occurred.
cDOMElement& GetRoot | ( | ) |
Returns the root element of the dom.
const cDOMElement& GetRoot | ( | ) | const |
Returns the root element of the dom.
tResult Load | ( | const tChar * | strFilename, |
const tBool & | bIgnoreIncludes = tFalse , |
||
const tUInt32 & | ui32OpenMode = cFile::OM_Read|cFile::OM_SharedRead|cFile::OM_SequentialAccess |
||
) |
Loads an xml file and creates the dom.
Included files have to be encapsulated by a root node which is omitted on including.
strFilename | [in] The filename. |
bIgnoreIncludes | [in] the special tag 'include' will be ignored! |
ui32OpenMode | [in] Open mode of the file access see cFile::tOpenMode (should be at least cFile::OM_Read) |
ERR_OPEN_FAILED | Reading process failed |
ERR_UNEXPECTED | Invalid XML tag |
Copy assignment operator.
oDOM | [in] The element to copy to. |
Save dom to an xml file.
strFilename | [in] The filename. |
bKeepIncludes | [in] If tTrue, will write existing xml includes into the file. |
ERR_FAILED | Saving process failed. |
tVoid SetRoot | ( | const cDOMElement & | oNewRoot | ) |
Set the root element of the dom.
oNewRoot | [in] The new root element. |
|
static |
Skips xml comment sections in a string.
pDom | [in] The pointer to the dom |
ptr | [inout] The location where to start skipping comments. This pointer will be advanced to the location after the comments. |
lstComment | [out] A list of comment sections that where encountered. |
pStart | [in] The beginning of the search |
cString ToString | ( | ) | const |
Creates an xml string representation of the dom.