C
Colin Goudie
How would you generate a schema for an complex type that needs atrributes
and match a pattern
i.e.
XML
<BaseIpAddress name="Base I.P. Address">203.0.171.191</BaseIpAddress>
the ip number in the tags needs to be correctly formatted
with minLength=7, maxLength=15, and pattern "
Currently I have this
<xs:element name="BaseIpAddress">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"
fixed="Base I.P. Address" />
<xs:attribute name="value" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="7" />
<xs:maxLength value="15" />
<xsattern
value="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="units" type="xs:string" use="optional"
fixed="I.P. Ver4 Address" />
</xs:complexType>
</xs:element>
But that equates to
<BaseIpAddress name="Base I.P.Address" value="0.0.0.0" units="I.P. Ver4
Address"/>
I'd like this not to be an empty tag
and match a pattern
i.e.
XML
<BaseIpAddress name="Base I.P. Address">203.0.171.191</BaseIpAddress>
the ip number in the tags needs to be correctly formatted
with minLength=7, maxLength=15, and pattern "
Currently I have this
<xs:element name="BaseIpAddress">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"
fixed="Base I.P. Address" />
<xs:attribute name="value" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="7" />
<xs:maxLength value="15" />
<xsattern
value="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="units" type="xs:string" use="optional"
fixed="I.P. Ver4 Address" />
</xs:complexType>
</xs:element>
But that equates to
<BaseIpAddress name="Base I.P.Address" value="0.0.0.0" units="I.P. Ver4
Address"/>
I'd like this not to be an empty tag