XML Schema Question

Discussion in 'XML' started by Colin Goudie, Feb 16, 2004.

  1. Colin Goudie

    Colin Goudie Guest

    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" />
    <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
    <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
     
    Colin Goudie, Feb 16, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,632
    Markus
    Nov 23, 2005
  2. Fred Smith
    Replies:
    1
    Views:
    980
    Martin Honnen
    Feb 5, 2004
  3. Hari Om
    Replies:
    1
    Views:
    474
    Martin SChukrazy
    Mar 2, 2004
  4. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,309
    Stanimir Stamenkov
    Apr 25, 2005
  5. Replies:
    3
    Views:
    3,052
Loading...

Share This Page