Looks like a very useful lib.
There were a few issues I had with it, however. It saves the nodes arse about, so that those created first in code are at the bottom of the file and those created last are at the top. This makes the file difficult to read, and may cause incompatibility with other XML readers (I don't know if node position is actully a relevant factor with XML).
Also, 'xmlSave' seems to be returning an error result (false) even when there isn't one.
Here's the code I tested with:
And here's the result:
There were a few issues I had with it, however. It saves the nodes arse about, so that those created first in code are at the bottom of the file and those created last are at the top. This makes the file difficult to read, and may cause incompatibility with other XML readers (I don't know if node position is actully a relevant factor with XML).
Also, 'xmlSave' seems to be returning an error result (false) even when there isn't one.
Here's the code I tested with:
Include "BlitzXML_v1.7\BlitzXML.bb" Graphics 800, 600, 0, 2 root = xmlNodeAdd( 0, "root" ) ; Create the root node. head = xmlNodeAdd( root, "head" ) ; Create the 'head' node. xmlNodeAttributeValueSet( head, "name", "head" ) xmlNodeDataSet( head, "head" ) title = xmlNodeAdd( head, "title" ) ; Create the 'title' node. xmlNodeAttributeValueSet( title, "name", "title" ) xmlNodeDataSet( title, "title" ) body = xmlNodeAdd( root, "body" ) ; Create the 'body' node. xmlNodeAttributeValueSet( body, "name", "body" ) xmlNodeDataSet( body, "body" ) data_1 = xmlNodeAdd( body, "data_1" ) ; Create the 'data_1' node. xmlNodeAttributeValueSet( data_1, "name", "data_1" ) xmlNodeDataSet( data_1, "data_1" ) data_2 = xmlNodeAdd( body, "data_2" ) ; Create the 'data_2' node. xmlNodeAttributeValueSet( data_2, "name", "data_2" ) xmlNodeDataSet( data_2, "data_2" ) If xmlSave( "xmltest.xml", root ) ; If no error occurred... Print "File saved ok." Else ; An error occurred, so... Print "An error occurred." num_errors = xmlErrorCount() Print num_errors For i = 1 To num_errors Print "Error: " + xmlError$( i ) Next EndIf WaitKey End
And here's the result:
<?xml version="1.0" ?> <root> <body name="body"> body <data_2 name="data_2">data_2</data_2> <data_1 name="data_1">data_1</data_1> </body> <head name="head"> head <title name="title">title</title> </head> </root>