Results 1 to 2 of 2

Thread: Embeded XML question -- thanks

  1. #1
    Join Date
    Dec 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Embeded XML question -- thanks

    OK, so my XML data looks like this:

    <xml id = "internalXMLData">

    <Contacts>
    <Contact>
    <Name>Jonnie Graham</Name>
    <Phone type="home">(09) 3888 466</Phone>
    <Phone type ="mobile"/>
    <Phone type ="work"/>
    <email>jonnie@poomail.com</email>
    <email>jonnie@shitmail.com</email>
    </Contact>

    <Contact>
    <Name>Andre Sapeas</Name>
    <Phone type="home"/>
    <Phone type="mobile">(123) 456 3757</Phone>
    <Phone type="work"/>
    <email>info@somedomain.co.nz</email>
    <email>andre_sapeas@somedomain.com</email>
    </Contact>
    <Contacts>

    </xml>

    ...see how there is more than 1 "type" of phone number, and more than 1 possible email address?

    to reference, say the Name, we would write: <span datafld="Name">, but how would we reference each "type" of phone number (or in other words how woud one reference each specifically/uniquely attributed phone number?), -for example??

    Thanks heaps!

  2. #2
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    I'm not sure, but use code something a little like this:

    Code:
    xmldocvariablename.getElementsByTagName("Phone").getAttribute("type");
    (this uses javascript)



    -magicyte
    Last edited by magicyte; 12-03-2008 at 02:07 AM.

Bookmarks

Posting Permissions

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