0
我已經寫了一個XML文檔,它被輸入到XSLT,然後是XSLFO,它一切正常,並生成可愛的格式化的PDF。我寫的模式是拋出一個錯誤,這是一個問題,因爲結構是項目的核心。Schema newbie - 暫時停留一週以上
XML文檔例如:
<sect>
<summ>
<p>
Here's some text.
</p>
<img src="www.someaddress.com"/>
<p>
Here's more text.
</p>
</summ>
<sect>
相應的模式的(爲了節省空間我已刪除從每個XS的一些要素:選擇的):
<xs:element name="img">
<xs:complexType>
<xs:attribute name="src" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="summ">
<xs:complexType>
<xs:choice>
<xs:element maxOccurs="unbounded" ref="p"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="img"/>
</xs:choice>
</xs:choice>
<xs:attribute name="title"/>
</xs:complexType>
</xs:element>
<xs:element name="sect">
<xs:complexType mixed="true">
<xs:choice maxOccurs="unbounded">
<xs:element ref="summ"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="p">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="img"/>
</xs:choice>
</xs:complexType>
</xs:element>
我希望能夠允許出現在「p」的內部和外部,當我對模式進行驗證時,它會拋出一個錯誤「cvc-complex-type.2.4.a:發現從元素'img'開始的無效內容。預計'{p}'。「
所以最好我會希望下面是有效的:
<sect>
<summ>
<p>
Here's some text.
</p>
<img src="www.someaddress.com"/>
<p>
<img src="www.someotheraddress.com"/>
</p>
</summ>
<sect>
如果你能幫助那麼我會非常感激:)