XML Classes
The DotHRB Xml class streamlines XML file operations. Offering an interface that is both simple and efficient, it allows applications to rapidly generate and parse XML data seamlessly.
Important
These classes are not intended to be a complete XML standard implementation. The XML specification is vast; these classes focus on the most common tasks building, saving, and iterating through elements prioritizing performance and ease of use over full compliance with every niche aspect of the XML standard.
#include "dothrb.ch"
function main()
local root := XmlElement("books")
local book
local oIter
local oNode
book := XmlElement("book")
book:appendChild(XmlElement("title", "Title 1"))
root:appendChild(book)
book := XmlElement("book")
book:appendChild(XmlElement("title", "Title 2"))
root:appendChild(book)
root:Save("books.xml")
oIter := new XmlIteratorScan(root)
oNode := oIter:Find()
while oNode != NIL
outstd(oNode:cName, oNode:cData, hb_eol())
oNode := oIter:next()
end while
return nil