I presume you don't need to be reminded that the prefix used in the 
instance document may be different from the prefix used in the schema 
document, and that in fact either or both of these may have several 
prefixes bound to the same namespace simultaneously and/or sequentially...

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
http://www.ovff.org/pegasus/songs/threes-rev-11.html)



From:
Mark Brucks <bru...@charter.net>
To:
j-users@xerces.apache.org
Date:
10/21/2010 03:14 PM
Subject:
namespace prefixes



Here is the beginning of my schema file:


<xs:schema targetNamespace="http://www.foo.com/SchemaOne";
           xmlns:s1="http://www.foo.com/SchemaOne";
           xmlns:s2="http://www.foo.com/SchemaTwo";
           xmlns:s3="http://www.foo.com/SchemaThree";
           ...>

Using the XML Schema API, I parse the schema and have access to the 
resulting XSModel instance.  Using the method getNamespaceItems() I can 
get a list of XSNamespaceItem and using the getSchemaNamespace() method I 
can get all the namespaces. How do I get the associated prefix for each 
prefix?

Thanks - Mark

Reply via email to