[Expat-discuss] (no subject)

Karl Waclawek karl at waclawek.net
Mon Jun 30 14:10:52 EDT 2003


> I have an application which parses XML documents with some attribute values being QNames
(prefix:name). I would like to be able to know which URI corresponds to the prefix. I've done this
by pushing/popping <prefix, URI> pairs on/off a stack in response to calls to the
StartNamespaceDeclHandler/EndNamespaceDeclHandler functions.
>
>  Is it safe to just push the pointers instead of duplicating the prefix and namespace before
pushing them on the stack? i.e., does expat guanartee that the pointers passed to
StartNamespaceDeclHandler remain accessible until the corresponding EndNamespaceDecHandler call is
made?
>
> It seems logical to assume that expat maintains a stack of <prefix, URI> pairs so that it would be
able to pass a URI,sep, local name to XML_StartElementHandler. If this is correct, can anyone tell
me which expat source file contains the implementaion of the stack?

No need to do any of that. Expat will pass the prefix if you set the NSTriplet option.
Check the documentation in reference.html.

>
> Does expat check whether the URI string is syntactically correct? (I don't want this to be done
twice)

I am not sure if Expat checks the URI for conformance, and don't have the time to look at the
source.
Why don't you submit an incorrect URI to Expat and check the response?
I am interested in the outcome.

Karl




More information about the Expat-discuss mailing list