私は他の要素、属性、テキストも含むXML要素を持っています。サンプルXMLデータは次のとおりです。他の要素や属性、テキスト(すべて)を含む複合要素のXSDスキーマを記述できますか?
<property readonly="0" eraseable="1" >
<property readonly="0" eraseable="1" >
<property readonly="0" eraseable="1" >windows XP unknown SP unknown (Build unknown)</property>
<property readonly="0" eraseable="1" >Windows 5.1</property>
</property>
</property>
要素のXSDスキーマを定義します。 SimpleContentをComplexTypeに追加しようとしましたが、検証時にエラーが発生します。ここで私がしようとしているスキーマは次のとおりです。
<xs:element name="property">
<xs:complexType >
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
<xs:sequence>
<xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" use="optional" type="xs:integer"/>
<xs:attribute name="readonly" use="required" type="xs:boolean"/>
<xs:attribute name="eraseable" use="required" type="xs:boolean"/>
</xs:complexType>
</xs:element>
私は、検証に乗るエラーは次のとおりです。
*「#AnonType_property」の内容が無効です。要素「配列」は無効な見当違いの、またはあまりにも頻繁に発生している*
私は、スキーマ定義から<xs:simpleContent>
を削除すると、私はエラーが出るよう:要素「プロパティが」文字[子供]を持つことができない
、なぜなら型のコンテンツタイプは要素のみです。
このような要素のスキーマはどのように記述しますか?
「混合」属性は、要素にいくつかのクレイジーな文章をオンに:)私は知っています。しかし問題は、テキストを要素の開始タグの間に制限しないことです。しかし、提案に感謝します。 – Shreerang