You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Justin Kirby <ju...@openaether.org> on 2003/10/29 02:29:38 UTC

startElement with multiple namespaces

I have a problem using SAX2 with the following xml:

<foo:bar xmlns:foo="foo:uri" xmlns="default:uri" attr="value"/>

When startElement is called it has the following values:
uri="foo:uri"
localname="stream"
qname="stream:stream"

The problem is that I need access to the default namespace before an
element is declared in that namespace. Is there anyway to obtain this
information?

Justin


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: startElement with multiple namespaces

Posted by Michael Glavassevich <mr...@apache.org>.
Hi Justin,

I'm not sure I understand what you're trying to do, but keep the following
in mind:

1) In SAX2 any namespaces declared on an element should be reported with
the startPrefixMapping event. startPrefixMapping is called before the
startElement event of the element which has the namespace declaration.
Similarly, endPrefixMapping is called after endElement.

2) The scope of a namespace ranges from the start of the element in which
it is declared to the end of this element.

3) Outside the scope of the default namespace, unprefixed names are in no
namespace. Even in the scope of the default namespace, unprefixed names of
attributes are in no namespace.

Hope that helps.

On Tue, 28 Oct 2003, Justin Kirby wrote:

> I have a problem using SAX2 with the following xml:
>
> <foo:bar xmlns:foo="foo:uri" xmlns="default:uri" attr="value"/>
>
> When startElement is called it has the following values:
> uri="foo:uri"
> localname="stream"
> qname="stream:stream"
>
> The problem is that I need access to the default namespace before an
> element is declared in that namespace. Is there anyway to obtain this
> information?
>
> Justin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

---------------------------
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org