Problem Parsing XML into ASP
Problem Parsing XML into ASP
am 13.09.2007 17:38:33 von ayo991
I am having a problem parsing XML into ASP. I have the follow XML
code from a server that reads
"
-
-
shown_results="1">
-
isbn="0766013502">
Paul Laurence Dunbar
Paul Laurence Dunbar: portrait of a poet
Catherine Reef
Berkeley Heights,
NJ : Enslow Publishers, c2000.
dewey_decimal_normalized="811.4" lcc_number="PS1557"
change_time="2005-04-03T07:24:51Z" price_time="2007-09-13T11:53:16Z" /
>
"
and here is my code
"<%
Dim xmlDoc
set xmlDoc = createObject("MSXML2.DOMDocument")
xmlDoc.async = False
xmlDoc.setProperty "ServerHTTPRequest", true
xmlDoc.load("http://XXXX.com//api/books.xml?
access_key=X&results=details&index1=isbn&value1=0766013502")
response.write xmldoc.documentelement.childnodes(0).Text
%>"
that displays
"Paul Laurence Dunbar Paul Laurence Dunbar: portrait of a poet
Catherine Reef Berkeley Heights, NJ : Enslow Publishers, c2000."
The problem that I am having is that I want it to break the xml up
into the individual categories with a response.write. Such as
Title: Paul Laurence Dunbar
Author: Catherine Reef
and so on. I cannot figure out what I need to do to display this
correctly. I have tried to change this
"xmlDoc.selectSingleNode("/SBNdb /BookList/
BootData").Attributes.GetNamedItem("Title").Text "
but I am not having any luck. Any help would be greatly appreciated.
Re: Problem Parsing XML into ASP
am 14.09.2007 09:38:24 von Anthony Jones
wrote in message
news:1189697913.485852.65540@50g2000hsm.googlegroups.com...
> I am having a problem parsing XML into ASP. I have the follow XML
> code from a server that reads
>
> "
> -
> -
> shown_results="1">
> -
> isbn="0766013502">
> Paul Laurence Dunbar
> Paul Laurence Dunbar: portrait of a poet
> Catherine Reef
> Berkeley Heights,
> NJ : Enslow Publishers, c2000.
>
> dewey_decimal_normalized="811.4" lcc_number="PS1557"
> change_time="2005-04-03T07:24:51Z" price_time="2007-09-13T11:53:16Z" /
> >
>
>
> "
>
> and here is my code
>
> "<%
> Dim xmlDoc
> set xmlDoc = createObject("MSXML2.DOMDocument")
>
> xmlDoc.async = False
> xmlDoc.setProperty "ServerHTTPRequest", true
> xmlDoc.load("http://XXXX.com//api/books.xml?
> access_key=X&results=details&index1=isbn&value1=0766013502")
>
> response.write xmldoc.documentelement.childnodes(0).Text
> %>"
>
> that displays
>
> "Paul Laurence Dunbar Paul Laurence Dunbar: portrait of a poet
> Catherine Reef Berkeley Heights, NJ : Enslow Publishers, c2000."
>
> The problem that I am having is that I want it to break the xml up
> into the individual categories with a response.write. Such as
>
> Title: Paul Laurence Dunbar
> Author: Catherine Reef
>
> and so on. I cannot figure out what I need to do to display this
> correctly. I have tried to change this
>
> "xmlDoc.selectSingleNode("/SBNdb /BookList/
> BootData").Attributes.GetNamedItem("Title").Text "
>
> but I am not having any luck. Any help would be greatly appreciated.
>
Title element is not an attribute. id and isbn are examples of attributes.
Dim bookData : Set bookData =
xmlDoc.selectSingleNode("/ISBNdb/BookList/BookData/")
Dim titleLong : Set titleLong = xmlDoc.selectSingleNode("TitleLong")
Dim authorText : Set authorText = xmlDoc.selectSingleNode("AuthorText")
If Not titleLong Is Nothing Response.Write "Title: " & titleLong.text & "
/>"
If Not authorText Is Nothing Response.Write "Title: " & authorText .text &
"
"
--
Anthony Jones - MVP ASP/ASP.NET
Re: Problem Parsing XML into ASP
am 20.09.2007 23:03:25 von jp2code
That answer would take a while to write.
Try this site:
http://msconline.maconstate.edu/tutorials/ASP/default.htm
Very good tutorial.
wrote in message
news:1189697913.485852.65540@50g2000hsm.googlegroups.com...
>I am having a problem parsing XML into ASP. I have the follow XML
> code from a server that reads
>
> "
> -
> -
> shown_results="1">
> -
> isbn="0766013502">
> Paul Laurence Dunbar
> Paul Laurence Dunbar: portrait of a poet
> Catherine Reef
> Berkeley Heights,
> NJ : Enslow Publishers, c2000.
>
> dewey_decimal_normalized="811.4" lcc_number="PS1557"
> change_time="2005-04-03T07:24:51Z" price_time="2007-09-13T11:53:16Z" /
>>
>
>
> "
>
> and here is my code
>
> "<%
> Dim xmlDoc
> set xmlDoc = createObject("MSXML2.DOMDocument")
>
> xmlDoc.async = False
> xmlDoc.setProperty "ServerHTTPRequest", true
> xmlDoc.load("http://XXXX.com//api/books.xml?
> access_key=X&results=details&index1=isbn&value1=0766013502")
>
> response.write xmldoc.documentelement.childnodes(0).Text
> %>"
>
> that displays
>
> "Paul Laurence Dunbar Paul Laurence Dunbar: portrait of a poet
> Catherine Reef Berkeley Heights, NJ : Enslow Publishers, c2000."
>
> The problem that I am having is that I want it to break the xml up
> into the individual categories with a response.write. Such as
>
> Title: Paul Laurence Dunbar
> Author: Catherine Reef
>
> and so on. I cannot figure out what I need to do to display this
> correctly. I have tried to change this
>
> "xmlDoc.selectSingleNode("/SBNdb /BookList/
> BootData").Attributes.GetNamedItem("Title").Text "
>
> but I am not having any luck. Any help would be greatly appreciated.
>
Re: Problem Parsing XML into ASP
am 21.09.2007 09:25:41 von Anthony Jones
"jp2code" wrote in message
news:eP3gum8%23HHA.980@TK2MSFTNGP06.phx.gbl...
> That answer would take a while to write.
>
> Try this site:
> http://msconline.maconstate.edu/tutorials/ASP/default.htm
> Very good tutorial.
>
I disagree. I've just taken a look at a couple of the articles and they
leave some significant room for improvement. E.g., CDONTS instead of
CDOSYS and techniques described open to SQL injection attacks.
--
Anthony Jones - MVP ASP/ASP.NET