Dominating
Dominating

Reputation: 2930

How to reset XSD's element value type and save attribute?

I want to set in XSD that Parameter to have value only from type XML

If i replace this:

 <xs:element name="Parameter">
   <xs:complexType mixed="true">
     <xs:attribute name="Name" use="required" type="xs:string"/>
   </xs:complexType>
 </xs:element>

with this:

<xs:element name="Parameter">
  <xs:complexType>
    <xs:sequence>
      <xs:any minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

I loose the Name attribute... How to set value to be only valid XML and to save attribute Name?

Upvotes: 1

Views: 124

Answers (1)

jasso
jasso

Reputation: 13986

Just set the attribute definition after the sequence element.

<xs:element name="Parameter">
  <xs:complexType>
    <xs:sequence>
      <xs:any minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Name" type="xs:string" use="required" />
  </xs:complexType>
</xs:element>

Upvotes: 1

Related Questions