Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old April 21st, 2007, 11:05 PM
glbdev@gmail.com
Guest
 
Posts: n/a
Default Parse elements in XML feed

I need to pull items out of an XML feed.

Here is an example of the XML file:
- <TopNode>
- <XmlFeed>
- <GetListInCategory>
- <Data Count="937">
- <Table>
<EventID>567343</EventID>
<Event>NHL playoffs</Event>
<Date>2007-04-21T00:00:00.0000000-05:00</Date>
<Time>10:00 PM</Time>
<CategoryID>26</CategoryID>
<HeadlinerID>101828</HeadlinerID>
<VenueID>115920</VenueID>
</Table>
</data>
</GetListInCategory>
</TopNode>

I need to pull each item out of the <TABLEnode, such as
<CategoryID>. The current code I am using now pulls ALL the data but
I cannot access the invidual elements.

Here is my current code:

dim objHTTP
dim objXML
set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.open "GET","https://secure.myxmlfeed", false
objHTTP.send
set objXML = server.CreateObject("microsoft.xmldom")
objXML.async=false
objXML.load(objhttp.responsebody)
Response.Write(objxml.xml)

Can anyone tell me how to do this?

- Steve

  #2  
Old April 22nd, 2007, 08:25 AM
Anthony Jones
Guest
 
Posts: n/a
Default Re: Parse elements in XML feed


<glbdev@gmail.comwrote in message
news:1177192579.567005.51270@l77g2000hsb.googlegro ups.com...
Quote:
I need to pull items out of an XML feed.
>
Here is an example of the XML file:
- <TopNode>
- <XmlFeed>
- <GetListInCategory>
- <Data Count="937">
- <Table>
<EventID>567343</EventID>
<Event>NHL playoffs</Event>
<Date>2007-04-21T00:00:00.0000000-05:00</Date>
<Time>10:00 PM</Time>
<CategoryID>26</CategoryID>
<HeadlinerID>101828</HeadlinerID>
<VenueID>115920</VenueID>
</Table>
</data>
</GetListInCategory>
</TopNode>
>
I need to pull each item out of the <TABLEnode, such as
<CategoryID>. The current code I am using now pulls ALL the data but
I cannot access the invidual elements.
>
Here is my current code:
>
dim objHTTP
dim objXML
set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
Don't use the XMLHTTP in ASP it's not threadsafe. Use:-

Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
Quote:
objHTTP.open "GET","https://secure.myxmlfeed", false
objHTTP.send
Quote:
set objXML = server.CreateObject("microsoft.xmldom")
objXML.async=false
objXML.load(objhttp.responsebody)
If the remote source is behaving itself and sending a content-type header
with the value "text/xml" then you need only:-

Set objXML = objHTTP.ResponseXML
Quote:
Response.Write(objxml.xml)
>
Can anyone tell me how to do this?
Dim oTable
Dim oNode

Set oTable =
objXML.selectSingleNode("/TopNode/XMLFeed/GetListInCategory/Data/Table")

For Each oNode In oTable.selectNodes("*")
Response.Write oNode.tagName & " = " & oNode.Text & "<br />"
Next

Quote:
>
- Steve
>

  #3  
Old April 22nd, 2007, 08:35 AM
Pupkin
Guest
 
Posts: n/a
Default Re: Parse elements in XML feed



Google the RSS2HTML code. It can be easily customized to take any XML
doc and use it as a sort of lightweight database for web apps.

Quote:
I need to pull items out of an XML feed.
>
Here is an example of the XML file:
- <TopNode>
- <XmlFeed>
- <GetListInCategory>
- <Data Count="937">
- <Table>
<EventID>567343</EventID>
<Event>NHL playoffs</Event>
<Date>2007-04-21T00:00:00.0000000-05:00</Date>
<Time>10:00 PM</Time>
<CategoryID>26</CategoryID>
<HeadlinerID>101828</HeadlinerID>
<VenueID>115920</VenueID>
</Table>
</data>
</GetListInCategory>
</TopNode>
>
I need to pull each item out of the <TABLEnode, such as
<CategoryID>. The current code I am using now pulls ALL the data but
I cannot access the invidual elements.
>
Here is my current code:
>
dim objHTTP
dim objXML
set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.open "GET","https://secure.myxmlfeed", false
objHTTP.send
set objXML = server.CreateObject("microsoft.xmldom")
objXML.async=false
objXML.load(objhttp.responsebody)
Response.Write(objxml.xml)
>
Can anyone tell me how to do this?
>
- Steve
>
>
  #4  
Old April 22nd, 2007, 02:15 PM
glbdev@gmail.com
Guest
 
Posts: n/a
Default Re: Parse elements in XML feed

Thanks Anthony, I appreciate it. I will give this a try later this
afternoon.

- Gust
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

On Apr 22, 3:22 am, "Anthony Jones" <A...@yadayadayada.comwrote:
Quote:
<glb...@gmail.comwrote in message
>
news:1177192579.567005.51270@l77g2000hsb.googlegro ups.com...
>
>
>
>
>
Quote:
I need to pull items out of an XML feed.
>
Quote:
Here is an example of the XML file:
- <TopNode>
- <XmlFeed>
- <GetListInCategory>
- <Data Count="937">
- <Table>
<EventID>567343</EventID>
<Event>NHL playoffs</Event>
<Date>2007-04-21T00:00:00.0000000-05:00</Date>
<Time>10:00 PM</Time>
<CategoryID>26</CategoryID>
<HeadlinerID>101828</HeadlinerID>
<VenueID>115920</VenueID>
</Table>
</data>
</GetListInCategory>
</TopNode>
>
Quote:
I need to pull each item out of the <TABLEnode, such as
<CategoryID>. The current code I am using now pulls ALL the data but
I cannot access the invidual elements.
>
Quote:
Here is my current code:
>
Quote:
dim objHTTP
dim objXML
set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
>
Don't use the XMLHTTP in ASP it's not threadsafe. Use:-
>
Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
>
Quote:
objHTTP.open "GET","https://secure.myxmlfeed", false
objHTTP.send
set objXML = server.CreateObject("microsoft.xmldom")
objXML.async=false
objXML.load(objhttp.responsebody)
>
If the remote source is behaving itself and sending a content-type header
with the value "text/xml" then you need only:-
>
Set objXML = objHTTP.ResponseXML
>
Quote:
Response.Write(objxml.xml)
>
Quote:
Can anyone tell me how to do this?
>
Dim oTable
Dim oNode
>
Set oTable =
objXML.selectSingleNode("/TopNode/XMLFeed/GetListInCategory/Data/Table")
>
For Each oNode In oTable.selectNodes("*")
Response.Write oNode.tagName & " = " & oNode.Text & "<br />"
Next
>
>
>
>
>
Quote:
- Steve- Hide quoted text -
>
- Show quoted text -- Hide quoted text -
>
- Show quoted text -

  #5  
Old April 22nd, 2007, 02:15 PM
glbdev@gmail.com
Guest
 
Posts: n/a
Default Re: Parse elements in XML feed

Pupkin,

I never heard of RSS2HTML but will look into it.

Thanks,
- Steve
================================================== ================================================== ======

On Apr 22, 3:25 am, Pupkin <spamag...@dorrk.comwrote:
Quote:
Google the RSS2HTML code. It can be easily customized to take any XML
doc and use it as a sort of lightweight database for web apps.
>
>
>
Quote:
I need to pull items out of an XML feed.
>
Quote:
Here is an example of the XML file:
- <TopNode>
- <XmlFeed>
- <GetListInCategory>
- <Data Count="937">
- <Table>
<EventID>567343</EventID>
<Event>NHL playoffs</Event>
<Date>2007-04-21T00:00:00.0000000-05:00</Date>
<Time>10:00 PM</Time>
<CategoryID>26</CategoryID>
<HeadlinerID>101828</HeadlinerID>
<VenueID>115920</VenueID>
</Table>
</data>
</GetListInCategory>
</TopNode>
>
Quote:
I need to pull each item out of the <TABLEnode, such as
<CategoryID>. The current code I am using now pulls ALL the data but
I cannot access the invidual elements.
>
Quote:
Here is my current code:
>
Quote:
dim objHTTP
dim objXML
set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.open "GET","https://secure.myxmlfeed", false
objHTTP.send
set objXML = server.CreateObject("microsoft.xmldom")
objXML.async=false
objXML.load(objhttp.responsebody)
Response.Write(objxml.xml)
>
Quote:
Can anyone tell me how to do this?
>
Quote:
- Steve- Hide quoted text -
>
- Show quoted text -

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles