[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Williams, Timothy W." <TIMOTHY.W.WILLIAMS@s...>
  • To: 'Avital Nagar' <Avital@c...>, xml-dev@l...
  • Date: Mon, 08 Oct 2001 07:22:44 -0400

Title: DOM
Something like this...
 
    Dim xmldoc As New MSXML2.DOMDocument
    
    xmldoc.Load "c:\temp\test.xml"
 
    Dim firstnames As MSXML2.IXMLDOMNodeList
    Set firstnames = xmldoc.getElementsByTagName("firstname")
   
    Dim i As Integer
    i = 0
    Do While i < firstnames.Length
        Response.write firstnames.Item(i).text
        i = i + 1
    Loop
 
--tim
-----Original Message-----
From: Avital Nagar [mailto:Avital@c...]
Sent: Monday, October 08, 2001 6:41 AM
To: xml-dev@l...
Subject: DOM

If I have an xml document that looks like this:

<shop>

        <location> US </location>

        <books>

                <title> Snow White </title>

                <author>

                        <firstname> Liza </firstname>

                        <lastname> Baker </lastname>

                </author>

                <author>

                        <firstname> Tanith </firstname>

                        <lastname> Lee </lastname>

                </author>

       

        </books>

</shop>

How can I get the firstnames? I have to display only the first name in asp. I know I have to use something with getelementsbytagname and firstChild.


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member