1
<response>
    <user id="0">
        <name>user1</name>
        <lastseen>19:30:00</lastseen>
    </user>
    <user id="1">
        <name>user2</name>
        <lastseen>19:27:00</lastseen>
    </user>
</response>

That's my xml document and I need to individually get each user's name and time last seen. How can I parse this xml like that with JavaScript?

  • 1
    If you know the *id*, why use *by-tag-name*? (Also, gEBTN is not part of the XML DOM, where is this XML from/used?) – user2864740 Feb 19 '14 at 18:19
  • 1
    If you don't mind using jQuery you can read a solution here: http://stackoverflow.com/questions/14782408/xml-jquery-reading – berentrom Feb 19 '14 at 18:19
  • possible duplicate of [XML parsing of a variable string in JavaScript](http://stackoverflow.com/questions/649614/xml-parsing-of-a-variable-string-in-javascript) – Felix Kling Feb 19 '14 at 18:21
  • @user2864740: `getElementsByTagName` is part of the DOM Level 1 specification: http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core.html#i-Document – Felix Kling Feb 19 '14 at 18:23
  • @FelixKling Thanks - you're correct. I ignored the relevant context. – user2864740 Feb 19 '14 at 18:24

0 Answers0