Shoutbox

XML and Metacharacters - 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: XML and Metacharacters (/showthread.php?tid=87305)

XML and Metacharacters by ArkaneArkade on 11-17-2008 at 05:19 AM

Hey guys,

After my many sleepless nights trying to get XML working from the internet, I've finally discovered my problem.  The XML file I am taking the information from contains multiple metacharacters which just break the function.

Now my problem is, that I need to find a solution for this, as these offending metacharacters (�, �, ñ ) are actually needed for the script to work in some instances.

The xml file is http://www.arkanes-arkade.co.uk/x360/x360-db.xml .  All of the metacharacters are part of a node attribute, and are how the data is searched for, so I either need some way to make the xml work (currently has no encoding specified... if there is a way that would help) or to make both the script and the php script which generates the xml to convert the characters into readable ones (such as (TM), (R), (n) ) so that the script will work properly.

The script is getting the info from xniff, which is why the metacharacters are actaully needed, its not just a case of me being awkward (at least not intentionally).

Anyone got any suggestions for me?

Cheers guys,
Leroux


RE: XML and Metacharacters by SmokingCookie on 11-17-2008 at 02:00 PM

You mean you're getting the XML file using Xniff?

You may as well use the XMLHTTP object.


RE: RE: XML and Metacharacters by ArkaneArkade on 11-17-2008 at 05:16 PM

quote:
Originally posted by SmokingCookie
You mean you're getting the XML file using Xniff?

You may as well use the XMLHTTP object.

God no!  Believe me, I'm using Xniff too much as it is.  It's my X360+ script - because Plus! can't actually detect when the XBOX Messenger changes PSM, Xniff listens for that, and gets the info through that.  It's the XBOX which sends the metacharacters, and so Xniff reads it raw.

The XMLHTTP is what I'm using to get the file, but if any of the metacharacters in it cause an "object required" error.
RE: XML and Metacharacters by SmokingCookie on 11-18-2008 at 05:26 PM

Have you saved the XML as Unicode (aka UTF-16)? If not, don't forget to alter the processing instruction:

code:
<?xml version="1.0" encoding="Unicode"?>

It may help..
RE: XML and Metacharacters by Matti on 11-18-2008 at 05:36 PM

quote:
Originally posted by SmokingCookie
Have you saved the XML as Unicode (aka UTF-16)?
It's even better to use UTF-16, as it's the official encoding declaration for this type of Unicode as stated here:
quote:
In an encoding declaration, the values "UTF-8", "UTF-16", "ISO-10646-UCS-2", and "ISO-10646-UCS-4" SHOULD be used for the various encodings and transformations of Unicode / ISO/IEC 10646, (...)
And we can better give script developers the most correct way to do it. :)
RE: XML and Metacharacters by ArkaneArkade on 11-18-2008 at 11:52 PM

Cheers guys.  The encoding was indeed what the problem was.  I'd skipped adding the encoding into the xml previously because it was screwing things up, but I guess I'd had it wrong.

Anyway, all working now, so thanks :D