Re: XML::Parser & "invalid character"
by Duncan Cameron other posts by this author
Mar 29 2002 7:54PM messages near this date
view in the new Beta List Site
Re: Re: XML::Parser & "invalid character"
|
Re: XML::Parser & "invalid character"
On 2002-03-29 Jenda Krynicky wrote:
> I'm using XML files to replicate some settings and other stuff
> between several servers (thanks for your previous help!). Everything
> is cool except one thing.
>
> I use character with code 2 as a separator or marker on several
> places in the database. Things like
> IF substring(PostingParameters.UserName,1,1) = char(2)
> -- then it's an ID of a field and I will use value of that field
> -- to log in
> ELSE
> -- its a constant
>
> or
> (from ASP) ... conn.SetPostingParameters(..., _
> CSVSeparator & chr(2) & CSVQuote _
> & chr(2) & CSVEscape, ...
>
> the problem is that if I write a string containing a chr(2) into an XML
> file, XMP::Parser (used via XML::Simple) will refuse to parse the file
> with
>
> not well-formed at line ...
>
> error message. So I've replaced the char(2)s with  in the
> generated XML. Still no success, it gives
>
> reference to invalid character number at line ...
>
> error message.
>
XML doesn't allow such a character value, see the XML character definition
http://www.w3.org/TR/2000/REC-xml-20001006#charsets
> Is there any way to "properly" escape such a character so that it
> would be accepted by XML::Parser?
No. It's invalid even if you try to specify it as a character entity
> And if not what character would you recomend to be used
> (escaped if necessary) to make XML::Parser happy, but still being
> reasonably safe that it will not be mistaken for "normal" data.
That depends on what your application defines as 'normal data'.
Not sure that I fully understand what you want to do so I can't really suggest
anything.
Regards,
Duncan Cameron
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Duncan Cameron
Jenda Krynicky
Barrie Slaymaker
|