What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Loading an invalid XML file

[?] Loading an invalid XML file
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. [?] Loading an invalid XML file
OK, I'm working on this script that gathers data from a website, but the page's source cannot be loaded into the XMLDOM ActiveX. I currently have a hard-coded method that makes the source XML-valid, but that's not dynamic enough. I'm trying to get the <title> node of the page. Any ideas on a more dynamic method?
05-29-2009 06:36 PM
Profile PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: [?] Loading an invalid XML file
Well, if you want just the content of the the <title> tode, perhaps String.indexOf() method together with String.substring() method is enough :)
05-29-2009 06:47 PM
Profile PM Web Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: [?] Loading an invalid XML file
Another alternative is to use a regular expression.
code:
/<\s*title\b[^>]*>([\s\S]*?)<\/\s*title\s*>/i.exec(oString);
var textInTitleNode = RegExp.$1;
[Image: markee.png]
05-30-2009 12:30 AM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: [?] Loading an invalid XML file
What's the URL of the XML you're trying to read? Maybe there is a solution to make XMLDOM parse it.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
05-30-2009 07:20 AM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [?] Loading an invalid XML file
Well, I've done what Minjul suggested. The regexp thingy doesn't work (returns an empty string). It's still a bit hard-coded, but that doesn't matter.
05-30-2009 03:01 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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