Shoutbox

[?] Loading an invalid XML file - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [?] Loading an invalid XML file (/showthread.php?tid=90837)

[?] Loading an invalid XML file by SmokingCookie on 05-29-2009 at 06:36 PM

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?


RE: [?] Loading an invalid XML file by Mnjul on 05-29-2009 at 06:47 PM

Well, if you want just the content of the the <title> tode, perhaps String.indexOf() method together with String.substring() method is enough :)


RE: [?] Loading an invalid XML file by markee on 05-30-2009 at 12:30 AM

Another alternative is to use a regular expression.

code:
/<\s*title\b[^>]*>([\s\S]*?)<\/\s*title\s*>/i.exec(oString);
var textInTitleNode = RegExp.$1;

RE: [?] Loading an invalid XML file by Matti on 05-30-2009 at 07:20 AM

What's the URL of the XML you're trying to read? Maybe there is a solution to make XMLDOM parse it.


RE: [?] Loading an invalid XML file by SmokingCookie on 05-30-2009 at 03:01 PM

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.