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 Bob Schloss <rs...@us.ibm.com> on 2003/04/27 14:42:01 UTC

Re: Ho wdo you use multiple Namespaces in a Schema




Marco,

      There are examples on the Internet.  For example, see
http://www.w3.org/2001/SMIL20/schemas.zip .

      Here is a small example:
instance document
<ns1:foo xmlns:ns1="http://example.com/namespace/one"
xmlns:ns2="http://example.com/namespace/two">
  <ns2:bar>hello</ns2:bar>
</ns1:foo>

schema-document-one.xsd
<xs:schema targetNamespace="http://example.com/namespace/one"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:ns2="http://example.com/namespace/two">
 <xs:import namespace="http://example.com/namespace/two"
schemaLocation="schema-document-two.xsd"/>
 <xs:element name="foo">
   <xs:complexType>
     <xs:sequence>
        <xs:element ref="ns2:bar"/>
     </xs:sequence>
   <xs:complexType>
 </xs:element>
</xs:schema>

schema-document-two.xsd
<xs:schema targetNamespace="http://example.com/namespace/two"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="bar" type="xs:string"/>
</xs:schema>

The point is that the element, attributes, and types associated with each
individual namespace will be defined in separate .xsd documents.
They are normally linked together via the <import> element information
item.

Good Luck,
Bob


XML/XSL Transformational Systems - Extensible Technologies
IBM Thomas J. Watson Research Center
Yorktown Heights, New York, USA






                                                                                                                              
                      "mmfive"                                                                                                
                      <mmfive@netspace.        To:       <xe...@xml.apache.org>                                       
                      net.au>                  cc:                                                                            
                                               Subject:  Ho wdo you use multiple Namespaces in a Schema                       
                      04/26/2003 06:46                                                                                        
                      AM                                                                                                      
                      Please respond to                                                                                       
                      xerces-j-user                                                                                           
                                                                                                                              




Hi All,
         I have been looking everywhere and I’m wondering how you use
multiple Namespaces in a XML file with a matching Schema, which references
and uses the multiple Namespaces? Are there ANY examples on the Internet?
How do reference them in a Schema? Is there any information??? I’m getting
desperate?


Thanks Marco.