Parse elements in XML feed

Parse elements in XML feed

am 21.04.2007 23:56:19 von glbdev

I need to pull items out of an XML feed.

Here is an example of the XML file:
-
-
-
-
-


567343
NHL playoffs
2007-04-21T00:00:00.0000000-05:00

26
101828
115920





I need to pull each item out of the node, such as
. 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

Re: Parse elements in XML feed

am 22.04.2007 09:22:12 von Anthony Jones

wrote in message
news:1177192579.567005.51270@l77g2000hsb.googlegroups.com...
> I need to pull items out of an XML feed.
>
> Here is an example of the XML file:
> -
> -
> -
> -
> -


> 567343
> NHL playoffs
> 2007-04-21T00:00:00.0000000-05:00
>
> 26
> 101828
> 115920
>

>
>
>
>
> I need to pull each item out of the node, such as
> . 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 & "
"
Next


>
> - Steve
>

Re: Parse elements in XML feed

am 22.04.2007 09:25:47 von Pupkin

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:
> -
> -
> -
> -
> -


> 567343
> NHL playoffs
> 2007-04-21T00:00:00.0000000-05:00
>
> 26
> 101828
> 115920
>

>
>
>
>
> I need to pull each item out of the node, such as
> . 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
>
>

Re: Parse elements in XML feed

am 22.04.2007 15:10:04 von glbdev

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

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

On Apr 22, 3:22 am, "Anthony Jones" wrote:

> wrote in message
>
> news:1177192579.567005.51270@l77g2000hsb.googlegroups.com...
>
>
>
>
>
> > I need to pull items out of an XML feed.
>
> > Here is an example of the XML file:
> > -
> > -
> > -
> > -
> > -


> > 567343
> > NHL playoffs
> > 2007-04-21T00:00:00.0000000-05:00
> >
> > 26
> > 101828
> > 115920
> >

> >
> >
> >
>
> > I need to pull each item out of the node, such as
> > . 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 & "
"
> Next
>
>
>
>
>
> > - Steve- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Re: Parse elements in XML feed

am 22.04.2007 15:11:17 von glbdev

Pupkin,

I never heard of RSS2HTML but will look into it.

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

On Apr 22, 3:25 am, Pupkin wrote:
> 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:
> > -
> > -
> > -
> > -
> > -


> > 567343
> > NHL playoffs
> > 2007-04-21T00:00:00.0000000-05:00
> >
> > 26
> > 101828
> > 115920
> >

> >
> >
> >
>
> > I need to pull each item out of the node, such as
> > . 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 -