나는 다음과 같은 방법에 따라 일부 XML XSD 유효성 검사를했다 : Xml validation using XSD schema'ref'속성을 사용할 수 없습니다. C#에서 유효성 검사 오류는
.......................................................
XmlReaderSettings settings = new XmlReaderSettings();
settings.Schemas.Add(null, xsdFilePath);
settings.ValidationType = ValidationType.Schema;
settings.ValidationEventHandler += new System.Xml.Schema.ValidationEventHandler(settings_ValidationEventHandler);
XmlDocument document = new XmlDocument();
document.Load(xmlFilePath);
XmlReader rdr = XmlReader.Create(new StringReader(document.InnerXml), settings);
while (rdr.Read())
{
}
...........................................................
그리고 그것은 나를 말하는 된 오차 제공 :
내 XSD는 " '심판'속성이 될 수 없다" 보이는 같은 :
...........
<xs:element name="totals" minOccurs="0" ref="DocTotal"/>
..................................
<xs:element name="DocTotal">
<xs:complexType>
<xs:sequence>
<xs:element name="totalQty" minOccurs="0" type="xs:decimal"/>
<xs:element name="totalTax" minOccurs="0" type="xs:decimal"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
내 XML은 다음과 같습니다
<totals>
<totalQty>800</totalQty>
<totalTax>0.00<totalTax>
</totals>
나는이 오류 때문에 모두 "이름" 및 "REF" 발생 믿습니다 속성은 같은 요소에 존재 :이 (이것에 귀하의 의견을 주셔서 감사합니다) XSD 잘못 아니라고 생각하지만이에 경우 XML이 XSD를 검증 할 수있는 방법이있다 :
그리고이 질문에 "java"라는 태그가 붙어 있기 때문에 ...? –
그것에 대해 미안 해요 – Bathiya
[this] (http://stackoverflow.com/q/8896602/238902) 도움이 될 수도 있습니다 – Default