c# - xsd schema not valid? -
I downloaded the official "schema of xsd".
\ Temp \ xsd.xsd ", FileMode.Open), valid); Sc.Compile (verify);
It has failed with the exception that she can not get some DTD.
Question number 1 : Why XSD schema defines XML can not handle legalization?
I removed the DTD definition from the top of the file and I found these (and many more) validation errors:
"Restrictions on any type of typing" Not allowed. "
Question number 2 : Why does the XSD schema effect fail?
I did it with XMLSkmat Set.add (...) and this worked .
Question no.3 : What is the difference between validating XmlSchema and XmlSchemaSet ?
Then I create a dummy schema which imports the XSD schema from the disk:
<: Import namespace = "http: //www.w3. Org / 2001 / XMLSchema "schema location =" C: \ temp \ xsd.xsd "/>
When I add this schema to the schema set then it's like the above
Question number 4 : Why is it different then to directly add the xsd schema (work)?
You need some other files Ogi referenced by the schema:
and. Once you download them, you can validate:
class program {static void main () {var settings = new XmlReaderSettings (); Settings.ProhibitDtd = false; (Var reader = XmlReader.Create (using "XMLSchema.xsd", Settings)) {settings.Schemas.Add (XmlSchema.Read (reader, blank); } (Var reader = XmlReader.Create ("xsd.xsd", settings)) {// it throws when the XML file is not valid (reader.Read ()); }}}
Comments
Post a Comment