[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l...
  • Subject: Schema issue with enumerated element content
  • From: russ@w...
  • Date: Fri, 18 Nov 2005 11:38:58 -0700

Hi,
 
I am trying to define an element that does two things:
 
1 - Provides an enumerated list of valid text content items, allowing multiple items
2 - Provides an attribute.
 
So far, I have the following, which satisfies #1, but I can't figure out how to add an attribute. Any ideas?
 
Thanks in advance,
Russ
 
 
<xs:element name="ElemName">
  <xs:complexType>
    <xs:simpleContent>
      <xs:restriction base="xs:anyType">
        <xs:simpleType>
          <xs:list>
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="Value1"></xs:enumeration>
                <xs:enumeration value="Value2"></xs:enumeration>
                <xs:enumeration value="Value3"></xs:enumeration>
                <xs:enumeration value="Value4"></xs:enumeration>
              </xs:restriction>
            </xs:simpleType>
          </xs:list>
        </xs:simpleType>
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>
 
 
I'd like to create a valid element in the XML such as:
<ElemName attr="value">Value1 Value2</ElemName>

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member