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> > At 3:02 PM -0400 4/25/04, Karl Waclawek wrote:<br> > <br> > >Expat currently expands the reference to nothing, just like Xerces.<br> > >What else can one do? There is no streaming context for reporting attributes.<br> > ><br> > >> I don't see a clean solution here. Suggestions are appreciated, but I<br> > >> think we do need to address this case in the JavaDocs. I think I'm<br> > >> leaning toward throwing an exception, but others may feel differently.<br> > ><br> > >If there is an exception it would mean there is an error.<br> > >But is there?<br> </tt></font> <br><font size=2><tt><snip/></tt></font> <br><font size=2><tt><br> > According to the XML spec, "It is an error if an attribute value <br> > contains a reference to an entity for which no declaration has been <br> > read." Thus I think the error() method in ErrorHandler should be <br> > called, and if Xerces is not doing that but merely silently throwing <br> > away the entity reference then yes, that is a bug, and it should be <br> > fixed.</tt></font> <br> <br><font size=2><tt>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.</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> > -- <br> > <br> > Elliotte Rusty Harold<br> > [email protected]<br> > Effective XML (Addison-Wesley, 2003)<br> > http://www.cafeconleche.org/books/effectivexml <br> > http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA<br> > <br> > <br> > -------------------------------------------------------<br> > This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek<br> > For a limited time only, get FREE Ground shipping on all orders of $35<br> > or more. Hurry up and shop folks, this offer expires April 30th!<br> > http://www.thinkgeek.com/freeshipping/?cpg=12297<br> > _______________________________________________<br> > List: sax-devel, [email protected]<br> > See: http://www.saxproject.org/<br> > 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