Mega Code Archive

 
Categories / XML Tutorial / Namespace
 

Document Models with a Namespace

File: Schema.xsd <xsd:schema   xmlns:xsd="http://www.w3.org/2001/XMLSchema"   targetNamespace="http://www.rntsoft.com/namespaces/employee"   xmlns="http://www.rntsoft.com/namespaces/employee">   <xsd:element name="employee">    <xsd:complexType>     <xsd:sequence>      <xsd:element name="name" type="xsd:string"/>      <xsd:element name="email" type="xsd:string"/>      <xsd:element name="hireDate" type="xsd:string"/>     </xsd:sequence>    </xsd:complexType>   </xsd:element> </xsd:schema> File: Data.xml <?xml version="1.0"?> <em:employee   xmlns:em="http://www.rntsoft.com/namespaces/employee"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://www.rntsoft.com/namespaces/employee employee.xsd">   <name>Joe Smith</name>   <email>a@a.com</email>   <hireDate>2008-10-29</hireDate> </em:employee>