Illegal characters. BUT WHY ?

[email protected]
Newsgroups gmane.text.xml.sax.devel
Message-ID <[email protected]>
BDY.TXT (text/plain, 1.7 KB)
Hi,

I have implemented an XML file writer which replaces occurrences of 
control characters with character references, i.e. a backspace becomes 
&#x8; and formfeed becomes &#xC;

When I parse this XML file I get an "Illegal XML character" fatal error. 
I have figured out that these two chars are illegal characters according 
to the XML spec. I don't understand the rationale behind this and would 
be grateful if anyone could tell me.

Anyway, the requirement for my custom DOM model and the implemented DOM 
writer is that control characters should be made explicit in the XML 
file by representing them using unicode character references. The idea 
was that we can then rely on the parser expanding them at parse-time. 
Obviously, I could write my own character converter and use references 
like \b or \f in my file. I would however like to conform to the unicode 
character notation. Any ideas how I could do this ? Could I implement 
some custom error handling that takes care of the character conversion 
for these illegal characters ? I know that if there is a way to do this 
I will end up with XML that is not WF (thus XML editors will complain), 
but I am prepared to accept this.

Or is there a way to solve this by using entities ? But I guess not, I 
would just get the parse error when the entity declaration is parsed ?

Help would be much appreciated !!!!

     Stefan







-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
List: sax-devel, [email protected]
See:  http://www.saxproject.org/
https://lists.sourceforge.net/lists/listinfo/sax-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.