Hello, because i am new in XML how can i get the tag name?
<ROOT>
<NAME>Alex</NAME>
<YEAR>1950</YEAR>
</ROOT>
I want to get the string "NAME" from the <NAME> tag.
If you use DOM and JavaScript :
function load()
{
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
var currNode;
xmlDoc.async = false;
xmlDoc.load("nodename.xml");
try
{
currNode = xmlDoc.documentElement.childNodes.item(0);
alert(currNode.nodeName);
}
catch(e)
{
alert("error");
}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.