Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Xml DOM parsing

  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Xml DOM parsing

    Hi All,
    I need to check for availability of a specific tag name in Xml DOM parsing using javascript.How do i check for it, is there any method in javascript to handle this.

    Waiting for ur replies.
    Thanks & Regards,
    Srikanth S

  • #2
    Regular Coder
    Join Date
    Aug 2005
    Posts
    282
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How are you creating your XML DOM ?
    any examples of code?

    could be as easy as:

    Code:
    var list = DOMDocument.getElementsByTagName("yourtagname");
    if (list.length)
     // do something...

  • #3
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Div

    And what about the <div > elements. How to get those with the similar ids?

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by Katy Vlady
    And what about the <div > elements. How to get those with the similar ids?
    XML has nothing to do with HTML or XHTML elements such as <div>
    On the other hand, if you are talking about XHTML, the id must be unique on page/session, so that there must not be similar id's.

    What, in fact, is your problem? can u detail?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Some Details

    I have to parse html page. After that I receive DOM document and I need to get all <div> nodes with the ids that contains some text. Thank you for help

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    try (untested)

    var divs = DOMDocument.getElementsByTagName('div')
    for(var i=0;i<divs.length;i++){
    if(divs[i].firstChild && divs[i].firstChild.nodeType==3 && divs[i].id!=''){
    ........do something........
    }
    }

    should find all the divs which have text nested as firstChild and have an id
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #7
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    I'll try. Thank you


  •  

    Posting Permissions

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