[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: 0x19 is not a legal XML character

Subject: Re: 0x19 is not a legal XML character
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 28 Jun 2007 13:28:28 +0200
Re:  0x19 is not a legal XML character
Michael Kay wrote:
Of course, it can be valid content, in which case the XML documents should be opened as XML 1.1 documents.

I'm reluctant to join a thread that has been deemed by both the OP and Tommie to be off-topic, but in the interests of accuracy: x19 is a legal character in XML 1.1 only if written in the form of a numeric character reference. (Which means that encoding is definitely NOT an issue).

Aha, I forgot about that... This explains why the file *can* be read with unparsed-text *and* the 1.1 option set, and *cannot* be read as XML input document.


This also means that, if you have no control on the input and these characters are not escaped as num char ref, then one could write a filter app in XSLT like this:

<xsl:output method="text" use-character-maps="char-to-ent" />

<xsl:character-map name="char-to-ent">
   <xsl:output-character character="&#x16;" string="&amp;#x16;"/>
   <xsl:output-character character="&#x17;" string="&amp;#x17;"/>
   <xsl:output-character character="&#x18;" string="&amp;#x18;"/>
   <xsl:output-character character="&#x19;" string="&amp;#x19;"/>
</xsl:character-map>

<xsl:template match="/" name="main">
   <xsl:value-of select="unparsed-text('make-control-chars.xml')" />
</xsl:template>


But, of course, like Andrew pointed out, this is not the best way to go (though it is not uncommon in large systems to have data filtered before it reaches your application, and XLST can do quite a good job there).


-- Abel

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.