How to open a XML file without validating?
-
Hi, I need to open a well-formatted xml file (but not valid against DTD), i tried the following, sill reciving error: // <!DOCTYPE article SYSTEM "xyz.dtd"> txtReader = new XmlTextReader(@"D:\abc.xml"); reader = new XmlValidatingReader(txtReader); reader.ValidationType = ValidationType.None; xDoc = new XmlDocument(); xDoc.Load(reader); Regards, Hariharan C.
-
Hi, I need to open a well-formatted xml file (but not valid against DTD), i tried the following, sill reciving error: // <!DOCTYPE article SYSTEM "xyz.dtd"> txtReader = new XmlTextReader(@"D:\abc.xml"); reader = new XmlValidatingReader(txtReader); reader.ValidationType = ValidationType.None; xDoc = new XmlDocument(); xDoc.Load(reader); Regards, Hariharan C.
If you don't want to validate the XML file against a DTD, why are you using the XmlValidatingReader at all? Just remove it. BTW, unless you are still using .NET 1.x, the XmlValidatingReader[^] is now obsolete. You should use the validation options available on the XmlReader class instead.
Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush
-
If you don't want to validate the XML file against a DTD, why are you using the XmlValidatingReader at all? Just remove it. BTW, unless you are still using .NET 1.x, the XmlValidatingReader[^] is now obsolete. You should use the validation options available on the XmlReader class instead.
Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush
Hi, I am new to C#. I tried with the following and succeeded, txtReader = new XmlTextReader(@"abc.xml"); txtReader.XmlResolver = null; xDoc = new XmlDocument(); xDoc.Load(txtReader) Thanks, Hariharan C.