[XML-SIG] SAX2: Attribute extensions
uche.ogbuji@fourthought.com
uche.ogbuji@fourthought.com
Sun, 25 Apr 1999 09:13:37 -0600
> This posting specifies two interfaces for information needed by the
> DOM (and possibly also others) and also for full XML 1.0 conformance.
> I'm not really sure whether we should actually use all of this, so
> opinions are welcome.
>
> class AttributeList2:
>
> def isSpecified(self,attr):
> """Returns true if the attribute was explicitly specified in the
> document and false otherwise. attr can be the attribute name or
> its index in the AttributeList."""
This is pretty much essential for full DOM support, and thus it would help us
greatly for the SAX builder in 4DOM.
> def getEntityRefList(self,attr):
> """This returns the EntityRefList (see below) for an attribute,
> which can be specified by name or index."""
>
> The class below is inteded to be used for discovering entity reference
> boundaries inside attribute values. This is needed because the XML 1.0
> recommendation requires parsers to report unexpanded entity references,
> also inside attribute values. Whether this is really
> something we want is another matter.
I'm not clear on what the alternative is. For example,
<spam eggs="xx&monty;xx">
if the parser doesn't expand &monty;, do you suggest that it should instead
just return the literal "xx&monty;xx" as the attribute value. leaving the
application to spot the "&" and assume an entity reference appropriately?
This seems rather a shift in burden to the app. If this is not what you mean,
then it would seem to make sense for the parser to report unexpanded entity
refs.
> class EntityRefList:
>
> def getLength(self):
> "Returns the number of entity references inside this attribute value."
>
> def getEntityName(self, ix):
> "Returns the name of entity reference number ix (zero-based index)."
>
> def getEntityRefStart(self, ix):
> """Returns the index of the first character inside the attribute
> value that stems from entity reference number ix."""
>
> def getEntityRefEnd(self, ix):
> "Returns the index of the last character in entity reference ix."
>
>
> One redeeming feature of this interface is that it lives entirely
> outside the attribute value, and so can be ignored entirely by those
> who are not interested.
--
Uche Ogbuji
FourThought LLC, IT Consultants
uche.ogbuji@fourthought.com (970)481-0805
Software engineering, project management, Intranets and Extranets
http://FourThought.com http://OpenTechnology.org