开发者

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

开发者 https://www.devze.com 2023-03-09 10:01 出处:网络
I want to set in XSD that Parameter to have value only from type XML If i replace this: <xs开发者_C百科:element name=\"Parameter\">

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

If i replace this:

 <xs开发者_C百科: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?


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消