xsd'ye schematron doğrulaması eklemeye çalışıyorum. Bu benim yeni xsd geçerli:xsd doğrulama şematron kullanarak
<books>
<book publisher="ddd" on-loan="sdsd">
<title>idan title</title>
<author>idan author</author>
<publication-date>idan date</publication-date>
</book>
</books>
Ben doğrulama hatası alamadım sağlanan xml kullanarak:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
xmlns:sch="http://www.ascc.net/xml/schematron"
elementFormDefault="qualified" >
<xs:element name="books">
<xs:complextype>
<xs:sequence> ;P
<xs:element name="book" type="bookType" maxoccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<sch:pattern id="onLoanTests" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
<sch:rule context="book">
<sch:report test="@on-loan and not(@return-date)">
Every book that is on loan must have a return date
</sch:report>
</sch:rule>
</sch:pattern>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complextype>
</xs:element>
<xs:complextype name="bookType">
<xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="author" type="xs:string" />
<xs:element name="publication-date" type="xs:string" />
</xs:sequence>
<xs:attribute name="publisher" type="xs:string" use="required" />
<xs:attribute name="on-loan" type="xs:string" use="required" />
<xs:attribute name="return-date" type="xs:string" use="optional" />
</xs:complextype>
</xs:schema>
Bu benim test xml olduğunu.
"Ödünç verilen her kitabın bir iade tarihi olmalıdır" mesajını alacağımı ve xml'nin geçerli olmayacağını farz ettim. Nedeniyle ilgili öneriler?
Güncelleştirme OXygen xml düzenleyicisinde schematron doğrulamasını kullanarak çalışmayı başardım. Ancak, kodumda nasıl kullanacağım? Özel bir şey yüklemem gerekir mi? başka bir kütüphaneye bağlantı? "İşleme" bölümünde Update2 Görünüşe here
, gerekli tüm adımlar ayrıntılı olarak açıklanmıştır.