XMLlib does not parse

Dave Cragg dcragg at lacscentre.co.uk
Thu Jan 29 04:39:04 EST 2004


At 2:55 pm +0100 28/1/04, Björnke von Gierke wrote:
>I am new to XML and try to use rev to read a PAD file. I have a
>problem where the revCreateXMLTree function does generate this error:
>xmlerr, can't parse xml
>Unsupported encoding windows-1252
>
>however every xml I looked at had that encoding, so it seems to be
>quite often used, why then does rev not know it?

I don't think Rev's xml parser is the only one 
that doesn't handle Windows-1252 encoding. But 
you're right that it should support it.

As a temporary workaround (until support is 
addded) you could try changing the encoding to 
ISO-8859-1 before using revCreateXMLTree. The two 
encodings are not identical, but they might be 
close enough for many uses.

For example (assuming the xml data is in the tXML variable):

   replace "Windows-1252" with "ISO-8859-1" in tXML
   get revCreateXMLTree(tXML,false,true,false)

Note that this is a crude example for 
illustration. Apart from the encodings not being 
identical (Windows-1252 has additional characters 
to ISO-8859-1), the above script assumes that the 
text being replaced only occurs at the top of the 
xml data. A more "robust" replace function is 
probably necessary for serious application.

Cheers
Dave


More information about the use-livecode mailing list