Re: Re: [xml-dev] ues-attributes2/entity-resolver2/locator2 read-only?

Michael Glavassevich <[email protected]> Sun, 11 Apr 2004 15:33:11 -0400
Newsgroups gmane.text.xml.sax.devel
Message-ID <OF8A28767C.21D37320-ON85256E73.006786EF-85256E73.006B697E@ca.ibm.com>
Elliotte Rusty Harold <[email protected]> wrote on 04/09/2004 
08:48:03 AM:

> Perhaps this should be an option for parsers that wish to allow this 
> to be set. However, some parsers may not wish to make this an option 
> and prefer to make it a read-only property instead.

Based on the current javadoc for EntityResolver2, I believe this already 
is an option. It states: "If a SAX application requires the customized 
handling which this interface defines for external entities, it must 
ensure that it uses an XMLReader with the 
http://xml.org/sax/features/use-entity-resolver2 feature flag set to true 
(which is its default value when the feature is recognized). If that flag 
is unrecognized, or its value is false, or the resolver does not implement 
this interface, then only the EntityResolver method will be used." That 
sounds like read-write to me. A parser which recognizes the feature but 
doesn't support setting it to false should throw a 
SAXNotSupportedException.

> Simialrly, some parsers may wish to allow the user to specify whether 
> Locator2 or Locator objects are passed. Ditto for Attributes2 or 
> Attributes objects. Certainly not all parsers would want to allow 
> this. Read-only should be an option for all three. The question is 
> whether write ever makes sense. I'm not sure.

An instance of Locator2 is an instance of Locator. An instance of 
Attributes2 is an instance of Attributes. How would the user benefit from 
having the ability to forbid objects passed to them by the parser from 
implementing these subinterfaces? Applications not interested in the new 
features could just ignore them.
 
>    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

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