32 lines
802 B
Plaintext
32 lines
802 B
Plaintext
#include once "crt/stdio.bi"
|
|
#include once "crt/stdlib.bi"
|
|
#include once "libxml/tree.bi"
|
|
#include once "libxml/parser.bi"
|
|
|
|
'' Create a new document
|
|
Dim As xmlDocPtr doc = xmlNewDoc(Strptr("1.0"))
|
|
|
|
'' Create a root node
|
|
Dim As xmlNodePtr root_node = xmlNewNode(NULL, Strptr("root"))
|
|
|
|
'' Set the root node for the document
|
|
xmlDocSetRootElement(doc, root_node)
|
|
|
|
'' Create a new node
|
|
Dim As xmlNodePtr node = xmlNewNode(NULL, Strptr("element"))
|
|
|
|
'' Add some text to the node
|
|
xmlNodeSetContent(node, Strptr("Some text here"))
|
|
|
|
'' Add the new node to the root node
|
|
xmlAddChild(root_node, node)
|
|
|
|
'' Dump the document to stdout, it will be well formatted
|
|
xmlDocDump(stdout, doc)
|
|
|
|
'' Free the document
|
|
xmlFreeDoc(doc)
|
|
|
|
'' Free the global variables that may have been allocated by the parser
|
|
xmlCleanupParser()
|