开发者

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开发者_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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜