SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XML Parsing Problem

    i would like to know which is more faster while parsing XML File in JavaScript

    document.getElementById("MyID") ;

    Or
    Xpath="//MyID";
    XMLDoc.evaluate(xpath, XMLDoc, null, XPathResult.ANY_TYPE,null)

  2. #2
    SitePoint Addict ChiefLee's Avatar
    Join Date
    Apr 2009
    Location
    Lawrence KS
    Posts
    264
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm guessing document.getElementById is going to be faster most of the time, because it's cheaper to pull and element out of a hash table by key than to traverse a DOM to find it by Xpath. In most cases, the difference won't be noticeable.
    Add your logo to Pocket Folders.


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
  •