Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does an XML have to be more than one node?
Message
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
01067051
Message ID:
01067823
Views:
12
MartinJ,
THanks - I have never used those DOM properties - thanks for sharing them and their results. They will prove helpful to some of projects!:-)

So it seems that, unless the root tag (xml) has a question mark at both ends, is not valid. That explains why I spent a few hours of unproductive time earlier this week trying to use Xpath to access nodes and attributes.
Thanks

>Hi Terry,
>
>
>oXML=newObject("Msxml2.DOMDocument")
>oXML.async=.f.
>cXML=[<?xml version="1.0"><row>This is my row without a question mark</row>]
>?oXML.loadXML(cXML)
>?oxml.parseError.errorCode
>?oxml.parseError.reason
>
>
>
><?xml ... ?> is control/operative tag
>
><?xml ... > is unknown tag - not valid
>
>
>MartinJ
>
>>I do not know that (?xml version="1.0") is not valid - but I do know that XMLMSDOM2.Document seems to only "see" the nodes (tags) when the form is (?xml version="1.0"?)
>>Try it:
>>oXML=newObject("Msxml2.DOMDocument")
>>oXML.async=.f.
>>cXML=[<?xml version="1.0"><row>This is my row without a question mark</row>]
>>oXML.loadXML(cXML)
>>?oXML.childNodes.length && Returns a 0
>>?oXML.childNodes(0).text && Error: No childnodes
>>* Now put a question mark in
>>cXML=[<?xml version="1.0"?><row>This is my row with a question mark</row>]
>>oXML.loadXML(cXML)
>>?oXML.childNodes.length && Returns a 2
>>?oXML.childNodes(0).text && Returns 'version="1.0"'
>>?oXML.childNodes(1).text && Returns 'This is my row with a question mark'
>>* Make sure to clear
>>oXML.abort
>>release oXML
>>Does it work? It loads - but it does not address the nodes as configured in this scenario.
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform