When reading in an XML document with obvious errors in it, parseFile fails. So I try to get the last error, and it bombs out...
What am I doing wrong?
testXMLerror.bmx
testXMLerror.xml
What am I doing wrong?
testXMLerror.bmx
Import BaH.Libxml Local xmldoc:TxmlDoc = TxmlDoc.parseFile("testXMLerror.xml") DebugLog "Loaded" If xmldoc Then DebugLog "XML Valid" Local root:TxmlNode = xmldoc.getRootElement() DebugLog root.getName() Local children:TList = root.getChildren() For Local node:TxmlNode = EachIn children DebugLog " =>" + node.getname() Next Else DebugLog "Invalid XML Syntax" Local err:TxmlError = xmlGetLastError() If err Then DebugLog "ERROR MESSAGE" DebugLog err.getErrorMessage() DebugLog "CODE" DebugLog String(err.getErrorCode()) End If End If DebugLog "DONE"
testXMLerror.xml
<?xml version="1.0"?> <!--This is a comment--> <Game> <test> <Element name=#testing#> </test> </Game>