Reputation: 11
<Unit Number="1">
<Identifier Type="ABC" Text="STO0001"/>
<Identifier Type="DEF" Text="Some Value"/>
<Identifier Type="GHI" Text="20070805"/>
<Disposition Unit="Accept"/>
</Unit>
I need to validate that Type="DEF" Text="Some Value" is not empty
Something Like:
<xs:complexType name="requiredValue" abstract="true"/>
<xs:complexType name="Identifier">
<xs:complexContent>
<xs:extension base="requiredValue">
<xs:attribute name="Type" use="required" fixed="DEF"/>
<xs:attribute name="Text" type="NonEmptyString"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Upvotes: 1
Views: 225
Reputation: 4122
This is not exactly what you are after, but it might help you to do the bulk of the schema.
This allows you to upload a xml file and it will create a xsd schema or a DTD.
http://www.hitsw.com/xml_utilites/
This does the same sort of thing.
http://www.flame-ware.com/products/xml-2-xsd/Default.aspx
Pavel mentioned Schematron. To help construct these schemas you might like to use pyang.
http://code.google.com/p/pyang/
Upvotes: 1
Reputation: 16926
Using the xsd:minLength restriction:
<xsd:attribute name="Type">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
Upvotes: 0