Mega Code Archive

 
Categories / XML / XML Schema
 

Define and use attributeGroup

File: Data.xml <?xml version="1.0"?> <employees   xmlns="http://www.rntsoft.com/employees"   xmlns:name="http://www.rntsoft.com/name"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://www.rntsoft.com/employees Schema.xsd"   source="from where"   version="1.0"/> File: Schema.xsd <?xml version="1.0"?> <schema xmlns="http://www.w3.org/2001/XMLSchema"   xmlns:employees="http://www.rntsoft.com/employees"   targetNamespace="http://www.rntsoft.com/employees"   elementFormDefault="qualified">   <attributeGroup name="employeeAttributes">     <attribute name="version" type="decimal" fixed="1.0" />     <attribute name="source" type="string"/>   </attributeGroup>   <element name="employees">     <complexType>       <attributeGroup ref="employees:employeeAttributes"/>     </complexType>   </element> </schema>