You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Mark Brucks <br...@j3s.us> on 2003/08/26 17:53:02 UTC

access to namespace prefix

Given a namespace URI, I'm trying to get the namespace prefix.  How does 
one do this from within the PSVI framework?  XSObject has a 
getNamespace() method, but there is no getPrefix() method. 
 Alternatively, how does one get at the NamespaceSupport or 
SchemaNamespaceSupport instances that I assume must be created during 
schema processing?  If I could get access to these instances, I can get 
the namespace prefix.

Thanks - Mark Brucks




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


Re: access to namespace prefix

Posted by Mark Brucks <br...@j3s.us>.
Jeff:

Finally getting around to saying thanks for the reply.  I hadn't 
carefully read the namespace parts of the XML documents, and assumed 
that namespaces were not quite as flexible as they are (ie. I thought a 
prefix/namespace pair were fixed for an entire document).  Now I 
understand why I was asking the wrong question.

Thanks - Mark

Jeff Greif wrote:

>I don't think the namespace prefix is a part of the PSVI (or the XML infoset
>either).  The only aspects of namespace prefixes that would be in the
>infosets would be the xmlns:foo="fooNamespaceUri" attributes.
>
>In general, the mapping namespace <-> prefix is many to many.  The same
>prefix can be used for different namespaces at different nodes in the
>document.  At any given node, there may be multiple prefixes defined all for
>the same namespace.  But each node has only one prefix and only one
>namespace.
>
>A way to get the unique namespace <-> prefix association for any given
>element or attribute in a document is to get them from the DOM node in
>question using the standard getNamespaceURI() and getPrefix() methods.
>
>Jeff
>----- Original Message ----- 
>From: "Mark Brucks" <br...@j3s.us>
>To: <xe...@xml.apache.org>
>Sent: Tuesday, August 26, 2003 8:53 AM
>Subject: access to namespace prefix
>
>
>  
>
>>Given a namespace URI, I'm trying to get the namespace prefix.  How does
>>one do this from within the PSVI framework?  XSObject has a
>>getNamespace() method, but there is no getPrefix() method.
>> Alternatively, how does one get at the NamespaceSupport or
>>SchemaNamespaceSupport instances that I assume must be created during
>>schema processing?  If I could get access to these instances, I can get
>>the namespace prefix.
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>
>  
>



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


Re: access to namespace prefix

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
I don't think the namespace prefix is a part of the PSVI (or the XML infoset
either).  The only aspects of namespace prefixes that would be in the
infosets would be the xmlns:foo="fooNamespaceUri" attributes.

In general, the mapping namespace <-> prefix is many to many.  The same
prefix can be used for different namespaces at different nodes in the
document.  At any given node, there may be multiple prefixes defined all for
the same namespace.  But each node has only one prefix and only one
namespace.

A way to get the unique namespace <-> prefix association for any given
element or attribute in a document is to get them from the DOM node in
question using the standard getNamespaceURI() and getPrefix() methods.

Jeff
----- Original Message ----- 
From: "Mark Brucks" <br...@j3s.us>
To: <xe...@xml.apache.org>
Sent: Tuesday, August 26, 2003 8:53 AM
Subject: access to namespace prefix


> Given a namespace URI, I'm trying to get the namespace prefix.  How does
> one do this from within the PSVI framework?  XSObject has a
> getNamespace() method, but there is no getPrefix() method.
>  Alternatively, how does one get at the NamespaceSupport or
> SchemaNamespaceSupport instances that I assume must be created during
> schema processing?  If I could get access to these instances, I can get
> the namespace prefix.


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