XML Schema Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Colin Goudie

    #1

    XML Schema Question

    How would you generate a schema for an complex type that needs atrributes
    and match a pattern
    i.e.
    XML
    <BaseIpAddres s 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="BaseIpAdd ress">
    <xs:complexType >
    <xs:attribute name="name" type="xs:string " use="required"
    fixed="Base I.P. Address" />
    <xs:attribute name="value" use="required">
    <xs:simpleTyp e>
    <xs:restricti on base="xs:string ">
    <xs:minLength value="7" />
    <xs:maxLength value="15" />
    <xs:pattern
    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
    <BaseIpAddres s 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


Working...