MainXMLNode doesn't seem to return
Posted: Tue Feb 14, 2017 6:46 pm
The following SB code and XML code work OK in PureBasic, but in SpiderBasic the debug message after the call to MainXMLNode never appears. It's like MainXMLNode never returns.
Code: Select all
hXML = LoadXML(#PB_Any,"TestXML.xml")
If hXML
If IsXML(hXML)
Debug "IsXML OK"
If XMLStatus(hXML) = #PB_XML_Success
Debug "XMLStatus OK"
Debug "Calling MainXMLNode"
hParent = MainXMLNode(hXML)
Debug "MainXMLNode returned"
If hParent
Children = XMLChildCount(hParent)
Debug "Parent has " + Str(Children) + " children"
hChild = ChildXMLNode(hParent)
GrandChildren = XMLChildCount(hChild)
Debug "First child has " + Str(GrandChildren) + " chldren"
EndIf
Else
Debug "XMLStatus Failed, " + XMLError(hXML)
EndIf
Else
Debug "IsXML failed, " + XMLError(hXML)
EndIf
Else
Debug "LoadXML(#PB_Any,'TestXML.xml') failed"
EndIf
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Parent>
<Child>Child1
<GrandChild>GrandChild1</GrandChild>
<GrandChild>GrandChild2</GrandChild>
<GrandChild>GrandChild3</GrandChild>
<GrandChild>GrandChild4</GrandChild>
<GrandChild>GrandChild5</GrandChild>
</Child>
<Child>Child2
<GrandChild>GrandChild1</GrandChild>
<GrandChild>GrandChild2</GrandChild>
<GrandChild>GrandChild3</GrandChild>
<GrandChild>GrandChild4</GrandChild>
<GrandChild>GrandChild5</GrandChild>
</Child>
</Parent>