Lists Home |
Date Index |
- From: David Megginson <firstname.lastname@example.org>
- To: "XML Developers' List" <email@example.com>
- Date: Sun, 21 Mar 1999 13:59:35 -0500 (EST)
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)
public abstract void endEntity (String name)
public abstract void characters (char ch, int start, int length)
public interface AttributeValue2 extends AttributeValue
public abstract boolean isSpecified (String name);
public abstract void accept (AttributeValueHandler handler)
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 firstname.lastname@example.org
xml-dev: A list for W3C XML Developers. To post, mailto:email@example.com
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:firstname.lastname@example.org the following message;
To subscribe to the digests, mailto:email@example.com the following message;
List coordinator, Henry Rzepa (mailto:firstname.lastname@example.org)