What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » XML from internet

XML from internet
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: XML from internet
Hehe :P

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();

This post was edited on 11-24-2008 at 11:39 AM by SmokingCookie.
11-24-2008 11:38 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
XML from internet - by ArkaneArkade on 11-12-2008 at 06:22 PM
RE: XML from internet - by matty on 11-12-2008 at 06:35 PM
RE: XML from internet - by ArkaneArkade on 11-12-2008 at 07:03 PM
RE: XML from internet - by SmokingCookie on 11-24-2008 at 07:35 AM
RE: RE: XML from internet - by ArkaneArkade on 11-24-2008 at 08:41 AM
RE: XML from internet - by SmokingCookie on 11-24-2008 at 11:38 AM
RE: XML from internet - by ArkaneArkade on 11-26-2008 at 07:41 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On