Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > illegal character in xml file

Reply
Thread Tools

illegal character in xml file

 
 
Andy Fish
Guest
Posts: n/a
 
      02-06-2007
Hi,

I have an XML file that was created as a DOM tree in .Net 1.1 and serialized
to disk. If I try to put character code 1 inside one of the attributes
(don't ask why), it seems to serialize perfectly ok and I get a file that
looks like this:

<element attribute="" />

which looks perfectly valid but won't open up with an XML viewer because it
says it is an illegal character reference.

what am I missing here? surely it's legal to put any character reference in
an XML file as long as it's correctly encoded? and if it's not, how come the
framework serialized it for me without complaining?

TIA

Andy


 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      02-06-2007
Andy Fish wrote:
> surely it's legal to put any character reference in
> an XML file as long as it's correctly encoded?


No, it isn't. XML 1.0 limits the acceptable characters, and character
references do not work around those limits. (XML 1.1 relaxes this; see
the specs.)

> and if it's not, how come the
> framework serialized it for me without complaining?


Becuase the framework thought it was writing XML 1.1? Or, more likely,
because the framework simply didn't bother checking. Enforcing these
rules does have performance costs, which leads some systems to default
to not doing so (or not offer the option at all, expecting that you'll
do it earlier in the pipeline -- "If it hurts when you do that...").



--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML serialization of illegal character entities Mike McGranahan ASP .Net Web Services 0 07-11-2006 08:16 PM
illegal escape character Steve Rainbird Java 7 06-07-2006 11:00 PM
1.5-beta: meta data: illegal character: \64 Timo Nentwig Java 1 02-06-2004 11:12 AM
Re: Illegal XML character SAX Parser exception William Brogden Java 1 06-30-2003 06:11 AM
Re: Illegal XML character SAX Parser exception Michael Lee Java 0 06-27-2003 03:12 PM



Advertisments