[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 3 basic XML questions on: non-determism, reserved symbols,and xml:lang
- From: Richard Tobin <email@example.com>
- To: firstname.lastname@example.org
- Date: Wed, 23 May 2001 17:46:07 +0100 (BST)
> Can someone
> please clarify what it means that non-deterministic content models are
> not allowed in XML?
It's "an error" (rather than a validity or well-formedness error),
which means that parsers are not required to detect it. So the
parsers you mention are not wrong, just not as good as they might be.
>  It was also my understanding that the following symbols are
> "reserved", and may not be used in an instance document's data:
> < > & " '
> Instead, the "escaped" version must be used:
> < > & " '
> However, my experience is that XML Parsers do not require >, ", or ' to
> be escaped. Can someone please clarify what are the "reserved"
> symbols? When do I need to escape >, ", and '?
You always need to escape &, because it would otherwise be interpreted
as an entity reference. You always need to escape <, because in content
it would be interpreted as a start tag and in an attribute it's just
illegal (for historical reasons, I think). Quotes need only be
escaped in contexts where they would otherwise be misinterpreted
(i.e. inside strings quoted with the same kind of quote). > never
needs to be escaped; > is just for symmetry.
> However, I have found that
> whenever xml:lang is used on an element it must be declared in the DTD.
Yes, if you want the document to be valid. If you don't care about
validation - you're happy with well-formedness - you don't have to