On Apr 7, 2006, at 2:37 AM, realbasic-nug-
[EMAIL PROTECTED] wrote:
Subject: Re: What's a "malformed XML, invalid token" error?
From: "Marc Zeedar" <[EMAIL PROTECTED]>
Date: Fri, 7 Apr 2006 06:26:39 -0000 (GMT)
On Thu, April 6, 2006 7:35 am, Erne wrote:
as of the malformed xml error I'm sure I've seen that before
but just can't remember what caused it and how I solved it
maybe some bad char like CHR(0) in the data string...
YES! That's exactly what it turned out to be (well, chr(1) among
others).
Basically, control characters. Don't know how they got in the
user's data,
but deleting them seems to cause no harm. I tried encoding them into
entities but got an "illegal entity" error by the parser --
apparently the
only control characters allowed in XML are tabs, line feeds, and
carriage
returns.
Very odd. I've created a bug report for the inaccurate line number
report
problem: seumnocm
I was too slow or I'd have responded to this, too. What you are
seeing is exactly what I have experienced as well. Further,
experimentation with users using my app and encountering that error
has indicated these invisible control codes most often occur when the
(Windows) user copyies from web pages (possibly other sources as
well) and pastes them into edit fields that subsequently get saved in
XML files. And of course you're right; these characters are illegal XML.
I have written some Regular expressions to run (RegEx) against the
fields with the goal that it would remove any non-XML allowed
characters. Unfortunately, I haven't been lucky enough to hit upon
just the right solution yet. But perhaps someone out there who is
more expert with regular expression than I might post a solution...
D Evermore
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>