[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: SAX2 RFD: LexicalHandler draft v.1.1

  • From: David Megginson <david@m...>
  • To: "XML Developers' List" <xml-dev@i...>
  • Date: Sun, 21 Mar 1999 13:59:35 -0500 (EST)

Re: SAX2 RFD: LexicalHandler draft v.1.1
James Clark writes:

 > David Megginson wrote:
 > >     public abstract void startEntity (String name)
 > >         throws SAXException;
 > > 
 > >     public abstract void endEntity (String name)
 > >         throws SAXException;
 > How does this allow me to find out about entity references in attribute
 > values (including defaulted attribute values)?

This is an interesting problem, and I was thinking about it last night 
while I was out walking my dog.  One possible solution is to extend
AttributeList to provide access to this information somehow (as we'll
be extending it, no doubt, to provide access to isSpecified
information).  Here's one alternative:

  public interface AttributeValueHandler
    public abstract void startEntity (String name)
      throws SAXException;
    public abstract void endEntity (String name)
      throws SAXException;
    public abstract void characters (char ch[], int start, int length)
      throws SAXException;

  public interface AttributeValue2 extends AttributeValue
    public abstract boolean isSpecified (String name);
    public abstract void accept (AttributeValueHandler handler)
      throws SAXException;

With this approach, the 99.9% of SAX applications that don't care
about entity boundaries within attribute values can continue to use
getValue() (which returns a literal string), while the others can use
AttributeValueHandler if the parser supports it -- of course, the
parser can throw a SAXNotSupportedException if it thinks that this
whole thing is too pathological.

 > It might be convenient to distinguish parameter entities and general
 > entities here.  The application can do this itself by maintaining the
 > appropriate state, but there doesn't seem any advantage in munging
 > together general and parameter entities.

There are two alternatives here:

1. Declare that PEs will always have '%' prepended to their names; or
2. add a boolean parameter isParameterEntity.

I'll add (2) for now.

 > How would general entity references in default attribute values in
 > attribute list declarations be handled?

Probably using a method similar to the one I specified above.  Now I
remember why I didn't want to cover DTD-related events in SAX...

 > Would all parameter entity references be reported or just those at the
 > top-level (ie between markup declarations)?

All, I'd imagine -- would there be a good reason for not doing so?

 > I don't think support for entities can be fully designed without also
 > considering DTD information.

Correct -- I apologise for my omitted note from earlier (which Lars
also caught).  I am assuming that there is already a mechanism for
reporting entity declarations.

All the best,


David Megginson                 david@m...

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.