4

is it possible to load an XmlDocument like XDocument.Load(myXmlFile) without validating the document? I would like to do the validation myself later.

Teoman Soygul
  • 25,584
  • 6
  • 69
  • 80
user603007
  • 11,416
  • 39
  • 104
  • 168

2 Answers2

0

Take a look at the XmlReaderSettings Class which has properties used to control things like validation. There's no one-size-fits-all answer for turning off validation, as there are different things one may wish to turn off, so browse the object's properties to see what you need. This answer is an example of using the XmlReaderSettings.

Void Star
  • 2,401
  • 4
  • 32
  • 57
0

Validating XML refers to checking whether the schema maps to the xml data.

XML still has be well-formed in order for it to be loaded into the XmlDocument as it parses the xml into an internal structure.

aqwert
  • 10,559
  • 2
  • 41
  • 61
  • 1
    This isn't a complete answer. If a schema is referenced, it will try to validate against it. How does one avoid that? – Void Star Sep 19 '17 at 16:25