Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How to parse this XML - simple but I couldn't figure out

From: Peter Flynn <peter.nosp@-.--------.-->
To: NULL
Date: 1/6/2007 12:56:00 PM

denoxis wrote:
> Hi,
> 
> I have a simple XML response coming from a server. I am using
> Microsoft.XMLDOM object in VB script. For some reason I cannot parse
> this XML properly. Here is the response:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <main>
>    <email>anEmail</email>
>    <address>anAddress</address>
>    <boolean>Y</boolean>
>    <product>
>       <attribute1>someText</attribute1>
>       <attribute2>someNumber</attribute2>
>       <attribute3>someData</attribute3>
>       <attribute4>moreData</attribute4>
>    </product>
>    <queryDate>someDate</queryDate>
> </main>

That is well-formed XML, so the response is processable. If the file
was corrupt, then you would get an error message.

> I tried selectSingleNode("product") method but it returns empty.
> I also tried selectSingleNode("/main/product") with no avail.

/main/product returns one hit here (using xpathtester).
What do you get for /main/product/attribute1

> I just noticed response does not have a proper ending (</xml>) could it
> be the issue, or there is something else?

There is no such thing. The root element start-tag is <main> and the 
root element end-tag is </main>. There is no such element in this 
document as <xml>, so there is no need for any </xml>. Perhaps you are 
confusing the XML Declaration <?xml...> with element markup (no query).

///Peter
-- 
XML FAQ: http://xml.silmaril.ie/


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent