xerces DOM

Top  Previous  Next

Scripts > Class elements and c++ instructions > Parser class methods > Plugin methods > xerces DOM


XML documents can be produced, processed and written with the DOMDocument class of the Open source project




In the TextTransformer the corresponding operations are integrated into the interpreter in such a way, that the DOM-elements, which are wrapped in the dnode interface, can be used like node's. Except from the life time of the dnode, the only difference compared with the node is, that a connection to the DOMDocument class must made for the dnode. The instantiation of the DOMDocument class happens in the CTT_Xerces class and the Plugin can transport a pointer to this class. The connection is made by the single call of the GetDocumenttElement function for the root node of a dnode-tree.



dnode GetDocumentElement();


To connect dnodes with the DOMDocument of the plugin, code like the following has to be be executed:


dnode root = GetDocumentElement();


Analogously to the description of the tree construction from nodes further dnodes now can be added to the root dnode



void WriteDocument();

void WriteDocument(const str& xsFilename);


By means of the WriteDocument command the DOM can be issued in the form of XML.



WriteDocument(const str& xsFilename); 


xsFilename is the name with a complete path for the file into which the document shall be written. It can optionally be passed to the function WriteDocument. Without this parameter the document is written in TargetName. TargetName may not be passed as a parameter since otherwise the file would be tried to open a second time. An existing file with the name xsFilename is overwritten.

This page belongs to the TextTransformer Documentation

Home  Content  German