Re: Attribute values with unresolved entities

Michael Glavassevich <[email protected]> Sun, 25 Apr 2004 15:55:38 -0400
Newsgroups gmane.text.xml.sax.devel
Message-ID <OFA4F16B09.1CA6A7C4-ON85256E81.006BE6D8-85256E81.006D7631@ca.ibm.com>
This is a multipart message in MIME format.
--=_alternative 006D763085256E81_=
Content-Type: text/plain; charset="US-ASCII"

[email protected] wrote on 04/25/2004 03:10:14 PM:

> At 3:02 PM -0400 4/25/04, Karl Waclawek wrote:
> 
> >Expat currently expands the reference to nothing, just like Xerces.
> >What else can one do? There is no streaming context for reporting 
attributes.
> >
> >>  I don't see a clean solution here. Suggestions are appreciated, but 
I
> >>  think we do need to address this case in the JavaDocs. I think I'm
> >>  leaning toward throwing an exception, but others may feel 
differently.
> >
> >If there is an exception it would mean there is an error.
> >But is there?

<snip/>

> According to the XML spec, "It is an error if an attribute value 
> contains a reference to an entity for which no declaration has been 
> read." Thus I think the error() method in ErrorHandler should be 
> called, and if Xerces is not doing that but merely silently throwing 
> away the entity reference then yes, that is a bug, and it should be 
> fixed.

The XML spec also says: "It is an *error* for a fragment identifier 
(beginning with a # character) to be part of a system identifier." What is 
an error? The spec defines it as: "a violation of the rules of this 
specification; results are undefined. Unless otherwise specified, failure 
to observe a prescription of this specification indicated by one of the 
keywords MUST, REQUIRED, MUST NOT, SHALL and SHALL NOT is an error. 
Conforming software MAY detect and report an error and MAY recover from 
it." [1] The spec doesn't compel a parser to detect errors (besides 
violations of validity constraints, reported at user option), nor does it 
specify how a parser recovers if it chooses to.

[1] http://www.w3.org/TR/2004/REC-xml-20040204/#dt-error

> -- 
> 
>    Elliotte Rusty Harold
>    [email protected]
>    Effective XML (Addison-Wesley, 2003)
>    http://www.cafeconleche.org/books/effectivexml 
> 
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
> For a limited time only, get FREE Ground shipping on all orders of $35
> or more. Hurry up and shop folks, this offer expires April 30th!
> http://www.thinkgeek.com/freeshipping/?cpg=12297
> _______________________________________________
> List: sax-devel, [email protected]
> See:  http://www.saxproject.org/
> https://lists.sourceforge.net/lists/listinfo/sax-devel

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [email protected]
E-mail: [email protected]

--=_alternative 006D763085256E81_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2><tt>[email protected] wrote on 04/25/2004
03:10:14 PM:<br>
<br>
&gt; At 3:02 PM -0400 4/25/04, Karl Waclawek wrote:<br>
&gt; <br>
&gt; &gt;Expat currently expands the reference to nothing, just like Xerces.<br>
&gt; &gt;What else can one do? There is no streaming context for reporting
attributes.<br>
&gt; &gt;<br>
&gt; &gt;&gt; &nbsp;I don't see a clean solution here. Suggestions are
appreciated, but I<br>
&gt; &gt;&gt; &nbsp;think we do need to address this case in the JavaDocs.
I think I'm<br>
&gt; &gt;&gt; &nbsp;leaning toward throwing an exception, but others may
feel differently.<br>
&gt; &gt;<br>
&gt; &gt;If there is an exception it would mean there is an error.<br>
&gt; &gt;But is there?<br>
</tt></font>
<br><font size=2><tt>&lt;snip/&gt;</tt></font>
<br><font size=2><tt><br>
&gt; According to the XML spec, &quot;It is an error if an attribute value
<br>
&gt; contains a reference to an entity for which no declaration has been
<br>
&gt; read.&quot; Thus I think the error() method in ErrorHandler should
be <br>
&gt; called, and if Xerces is not doing that but merely silently throwing
<br>
&gt; away the entity reference then yes, that is a bug, and it should be
<br>
&gt; fixed.</tt></font>
<br>
<br><font size=2><tt>The XML spec also says: &quot;It is an *error* for
a fragment identifier (beginning with a # character) to be part of a system
identifier.&quot; What is an error? The spec defines it as: &quot;a violation
of the rules of this specification; results are undefined. Unless otherwise
specified, failure to observe a prescription of this specification indicated
by one of the keywords MUST, REQUIRED, MUST NOT, SHALL and SHALL NOT is
an error. Conforming software MAY detect and report an error and MAY recover
from it.&quot; [1] The spec doesn't compel a parser to detect errors (besides
violations of validity constraints, reported at user option), nor does
it specify how a parser recovers if it chooses to.</tt></font>
<br>
<br><font size=2><tt>[1] http://www.w3.org/TR/2004/REC-xml-20040204/#dt-error</tt></font>
<br><font size=2><tt><br>
&gt; -- <br>
&gt; <br>
&gt; &nbsp; &nbsp;Elliotte Rusty Harold<br>
&gt; &nbsp; &nbsp;[email protected]<br>
&gt; &nbsp; &nbsp;Effective XML (Addison-Wesley, 2003)<br>
&gt; &nbsp; &nbsp;http://www.cafeconleche.org/books/effectivexml &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
&gt; &nbsp; &nbsp;http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA<br>
&gt; <br>
&gt; <br>
&gt; -------------------------------------------------------<br>
&gt; This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek<br>
&gt; For a limited time only, get FREE Ground shipping on all orders of
$35<br>
&gt; or more. Hurry up and shop folks, this offer expires April 30th!<br>
&gt; http://www.thinkgeek.com/freeshipping/?cpg=12297<br>
&gt; _______________________________________________<br>
&gt; List: sax-devel, [email protected]<br>
&gt; See: &nbsp;http://www.saxproject.org/<br>
&gt; https://lists.sourceforge.net/lists/listinfo/sax-devel</tt></font>
<br>
<br><font size=2><tt>Michael Glavassevich<br>
XML Parser Development<br>
IBM Toronto Lab<br>
E-mail: [email protected]</tt></font>
<br><font size=2><tt>E-mail: [email protected]<br>
</tt></font>
--=_alternative 006D763085256E81_=--


-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
_______________________________________________
List: sax-devel, [email protected]
See:  http://www.saxproject.org/
https://lists.sourceforge.net/lists/listinfo/sax-devel