Hehe
Point is, that you may use XML attributes as in the example above, but you'll need to create an object (the "node" thingy in my code), or make several calls to selectSingleNode();
Take a look here:
xml code:
<?xml version="1.0" encoding="Unicode"?> <!-- This is a comment -->
<RootElement attribute="Every element may have attributes"> <!-- the root element is required; only one per doc -->
<Element attribute="This is an an attribute" /> <!-- self-closing lement (or whatever it's called) with an attribute -->
<Element>Element text</Element> <!-- this element has no attributes but element text -->
<Element attribute="Another tattribute">And some text</Element> <!-- This one's got both text and attributes -->
</RootElement> <!-- close RootElement -->
Now, to get text, and only text, you can use your own piece of code. If you want attributes and/or text, you may want to use this:
jscript code:
function getXMLStuff(XMLData) { // An XML string
var xml = new ActiveXObject("Microsoft.XMLDOM");
if(xml.loadXML(XMLData)) { // Load the XML string
var D = xml.selectSingleNode("/RootElement/Element"); // Select the first "Element" tag
var VAL = D.getAttribute("Attribute"); // This doesn't work
var Txt = D.text;
}
}
If you use XMLHTTP to download the XML file from the internet, you'll need either the XMLHTTP's methods to parse the XML, or use XMLDOM.loadXML();