Creating Vocabularies that Do Not Belong to a Namespace : targetNamespace « XML Schema « XML






Creating Vocabularies that Do Not Belong to a Namespace


File: Schema.xsd

<?xml version = "1.0" ?> 
<xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
   
   <xs:element name = "Customer" >
      <xs:complexType>
         <xs:sequence>
            <xs:element name = "FirstName" type = "xs:string" />
            <xs:element name = "MiddleInitial" type = "xs:string" />
            <xs:element name = "LastName" type = "xs:string" />
         </xs:sequence>
      </xs:complexType>
   </xs:element>
   
</xs:schema>

A conforming instance document would look something like this:

<?xml version = "1.0" ?>
<Customer xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation = "Schema.xsd">
   
   <FirstName>first</FirstName>
   <MiddleInitial>middle</MiddleInitial>
   <LastName>last</LastName>
</Customer>

 








Related examples in the same category

1.Set targetNamespace
2.targetNamespace and non-default namespace
3.Creating Vocabularies that Belong to a Namespace
4.Looking Behind Namespace Qualification