This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: xmllint and &


On Wed, Dec 18, 2002 at 09:06:49AM +0100, Morus Walter wrote:
> Daniel Veillard writes:
> > On Tue, Dec 17, 2002 at 10:58:04AM -0500, Jeff Beal wrote:
> > however I note that the DTDs installed on my system for DocBook have
> > <!ENTITY amp    "&#38;#38;"> <!-- AMPERSAND -->
> > instead in docbook/xml-dtd-4.2-1.0-14/ent/iso-num.ent
> > but older version had the old style declaration but commented:
> > 3.1.7/ent/iso-num.ent:
> >   <!-- predeclared in XML <!ENTITY amp   "&#x0026;"--> <!-- AMPERSAND -->
> > 
> >   strange,
> > 
> There's nothing strange here.
> It's just one of the reasons, why you don't like mixing SGML and XML 
> applications on unix.
> 
> The reason why you don't see a problem in your test, is that you don't use
> the entity. If you add a '&amp;' and use xmllint --loaddtd you will
> get the error. So your test case is a bit too small.
> 
> XML *requires* amp to be declared as 
> <!ENTITY amp    "&#38;#38;"> 
> (or &#x26;#x26; if one prefers hex codes)
> See section 4.6 of the xml spec.
> 
> I think the reason is, that reading the entity declaration makes
> &#38; from &#38;#38;, which is read again when the entity is used giving
> &. If you just declare it as &#38; reading the entity declaration gives
> & and when the entity is used a single '&' is found.

  Hum, right, I remember about this when I was debugging libxml2 entity
processing... There was this argument too (James Clark IIRC) that since
amp is predefined in the XML specification, that was overriding any 
declaraction made in the DTD, but weel the best it to fix the DTD, you are
right.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]