XMLReader

Unofficial Content

GeneXus supports the easyly reading and writing of XML files, through the XMLReader and XMLWriter extended data types.

To read an XML file, you just have to create a variable ot the XMLReader Data Type, and then, through the different methods and properties of the data type, obtain the information about the nodes.  

There is a Read() method that behaves like a cursor moving forward through the file one node at a time. Using some properties, such as Name and Value, it is possible to obtain the node’s data -in this case, its name and value. Therefore, the method Read() is used to “navigate” through the document in a sequential way obtaining its different nodes.

On the other hand, a variable of GeneXus data type XMLWriter must be defined in order to record XML files. Again, through the different methods (ie: Open, WriteBeginElement, WriteElement, etc) and properties of the data type, you can 'write' the nodes of the file.