Results 1 to 9 of 9

Thread: [RESOLVED] Reading XML File

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2002
    Posts
    70

    Resolved [RESOLVED] Reading XML File

    I'm fairly new at the whole XML thing, but I am trying to write some code that will give me data from an XML file.

    Here's my issue. I have a file with multiple levels, and the data I want is 7-8 levels deep.

    In the following XML file, I would like to return each <station> node, it's id attribute, and all of it's child-node data.

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
        <SOAP-ENV:Body>
            <ns1:downloadResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:TMSWebServices">
                <xtvdResponse xsi:type="ns1:xtvdResponse">
                    <messages xsi:type="ns1:messages">
                        <message>Your subscription will expire: 2006-10-19T22:26:10Z</message>
                    </messages>
                    <xtvd from="2006-07-19T05:00:00Z" to="2006-07-26T05:00:00Z" schemaVersion="1.3" xmlns="urn:TMSWebServices" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:TMSWebServices http://docs.tms.tribune.com/tech/xml/schemas/tmsxtvd.xsd">
                        <stations>
                            <station id="10035">
                                <callSign>AETV</callSign>
                                <name>A &amp; E Network</name>
                                <affiliate>Satellite</affiliate>
                            </station>
                            <station id="10021">
                                <callSign>AMC</callSign>
                                <name>AMC</name>
                                <affiliate>Satellite</affiliate>
                            </station>
                            <station id="16331">
                                <callSign>ANIMAL</callSign>
                                <name>Animal Planet</name>
                                <affiliate>Satellite</affiliate>
                            </station>
                            <station id="10284">
                                <callSign>AZNTV</callSign>
                                <name>AZNTV</name>
                                <affiliate>Satellite</affiliate>
                            </station>
                            <station id="18332">
                                <callSign>BBCA</callSign>
                                <name>BBC America</name>
                                <affiliate>Satellite</affiliate>
                            </station>
                            <station id="10051">
                                <callSign>BET</callSign>
                                <name>Black Entertainment Television</name>
                                <affiliate>Satellite</affiliate>
                            </station>
                        </stations>
                    </xtvd>
                </xtvdResponse>
            </ns1:downloadResponse>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    This file is a small part of a larger file (the Zap2It TV Listings Download), but I'm using this chunk to get some help.

    I would like to use SelectNodes with XPath query language, but I'm having some trouble wrapping my head around it.

    Any help would be much appreciated with an example specific to the XML I posted above.

    Thank You,
    Imp
    Last edited by ImpShial; Jul 21st, 2006 at 10:19 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width