473,324 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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

Apr 21 '07 #1
4 6933

<gl****@gmail.comwrote in message
news:11*********************@l77g2000hsb.googlegro ups.com...
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")
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
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

>
- Steve

Apr 22 '07 #2


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.

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

Apr 22 '07 #3
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:
<glb...@gmail.comwrote in message

news:11*********************@l77g2000hsb.googlegro ups.com...


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")
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
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


- Steve- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

Apr 22 '07 #4
Pupkin,

I never heard of RSS2HTML but will look into it.

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

On Apr 22, 3:25 am, Pupkin <spamag...@dorrk.comwrote:
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.
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- Hide quoted text -

- Show quoted text -

Apr 22 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: lawrence | last post by:
I wanted to test xml_parse_into_struct() so I took the example off of www.php.net and put this code up on a site: <?php $simple = <<<END <item>
2
by: Charles Stricklin | last post by:
If I have an RSS newsfeed like this: <?xml version="1.0" encoding="utf-8"?><!-- generator="whocares" --> <rss version="0.92"> <channel> <title>Website Name</title>...
8
by: anilby | last post by:
Hi, I wanted to write a script that will read the below file: <abcd label="ABC"> .. <efg label="EFGA"> ..... <decg label="ABDG"> ...
17
by: mickjames | last post by:
Hi, I'd like to include the whole web page content (as opposed to just the headlines) into RSS/XML to enable people to read them via rss feed readers. Question: how to convert HTML elements...
2
by: HDavis | last post by:
Admitedly I am a total newbie to PHP. Can someone see the extra "." in this code? Thanks! <?php if (empty($wp)){ require_once('wp-config.php');wp('feed=rss2');} header(Content-type:text/xml;...
1
by: Paul | last post by:
alllow_url_fopen if set to off. For some reason I can not access domxml_open_file(). And I need to read an xml feed. I can access the feed using cURL: $feed =...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
4
by: Damodhar | last post by:
Any one help me to parse the bellow xml feed please .. =========================================================== <item> <title>Green earthquake alert Japan(M=6.8) potentially affecting 4.6...
5
by: goldtech | last post by:
SAX XML Parse Python error message Hi, My first attempt at SAX, but have an error message I need help with. I cite the error message, code, and xml below. Be grateful if anyone can tell me...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.