Hi I need help in XML Parsing Am new to it
I need to know some tutorials for XML parsing in javascript
I got an XML document which I tried to parse to get the contents of FIRSTNAME
& LASTNAME
from the xml doc but cannot do so
My XML
<MESSAGE>
<HEADER>
<LOGIN>
00986544
</LOGIN>
</HEADER>
<SESSION>
<LATITUDE>
0.0
</LATITUDE>
<LONGITUDE>
0.0
</LONGITUDE>
<TYPE>PRELOGIN</TYPE>
<KEY>PRELOGIN/ID</KEY>
<APP/>
<TRANSACTION>PRELOGIN</TRANSACTION>
</SESSION>
<PAYLOAD>
<PRELOGIN>
<TABLE>
<FIRSTNAME> papapap</FIRSTNAME>
<LASTNAME> hajka</LASTNAME>
</TABLE>
</PRELOGIN>
</PAYLOAD>
</MESSAGE>
Below is the code I tried
var message = xml.documentElement.getElementsByTagName("MESSAGE");
var firstname = xml.documentElement.getElementsByTagName("FIRSTNAME");
var lastname = xml.getElementById("LASTNAME");
I get some HTMLCollection
Object as answer but not the name
Please guide .