[Expat-discuss] getting offset of attributes

Karl Waclawek karl at waclawek.net
Tue Mar 18 11:29:05 EST 2003


> Fabio Venuti writes:
>  > by using XML_GetCurrentByteIndex I can get the offset of the
>  > beginning of an element, but how can I get the offset of, say, an
>  > attribute?
> 
> That's not possible with the current API.  It will probably become
> possible in Expat 3.0; 

Only if we switch to reporting of attributes in a streaming fashion.
This would require changes to the tokenizer, since it does not
report attributes as separate events.

We have also looked at solving the issues of reporting entity boundaries
in attribute values and declarations by inserting marker characters
followed by the entity name or a pointer to an entity structure.

Reporting the attributes all in one event together with the element start
tag seems almost necessary for some situations, like declaring namespace
prefixes that are used *before* the associated attribute is encountered. 
With a streaming model the problem is that the element's qualified name
cannot be be associated with an URI until the element's attribute that
declares the prefix is read.

Karl



More information about the Expat-discuss mailing list