0

In An XML Schema. Say I already have a root element and this is a child element

<car type="firebird">1970 Red Firebird</car>

In an XML Schema how do I declare that attribute?

Also if I have more than one element and declare "minOccours" do I need to declare "maxOccours" also? I'm using this link as an example. XML Schema: how to have multiple identical elements?

Community
  • 1
  • 1
Howdy_McGee
  • 10,422
  • 29
  • 111
  • 186

1 Answers1

2

You declare a "complex type with simple content"

<xs:complexType name="car">
  <xs:simpleContent>
    <xs:extension base="xs:string">
      <xs:attribute name="type" type="xs:string"/>
    </xs:extension>
  <xs:simpleContent>
</xs:complexType>

(Not tested, and not necessarily right - the syntax isn't exactly memorable).

Michael Kay
  • 156,231
  • 11
  • 92
  • 164