I know what all the elements are going to be, and all except one is mandatory. The way is grabs errors is by getting the error string from a dictionary, where the key is the XML node name, and the value is the error message: The code works fine, but I cant help but think that I did more than I needed to. For billing, it could either be credit card info or checking info, so I need to check the first child's name to see what the billing type is. I'm strictly speaking about how I'm reading the XML, validating data, and assigning values in this case. Is there a better way I can go about reading XML data and assigning values while validating the data? I need to receive an XML post then process all the data, and do whatever I need to do with the data. Empty; private Int64 phone Number; private string billing Method = string. Empty; private Int64 cc Number; private void Read Xml() , etc.). I could be receiving anywhere from 60 to 100 values. If it is not in the correct format, it will add an error to errors. While it is nice to have a reference to the XSD within the XML (when using the document in XML editors), it is not required for the LINQ to XML validation to work.
This task is accomplished using the File System Watcher class in the System. Once an XML file is detected in the watch folder, it needs to be validated using the Xml Validator class I'll describe in this article.
Is there any way to tell XMLValidating Reader where the schema file is, or am I missing anything?
TIA, Joe Z I have a question about using XMLValidating Reader. In the xml data file, if I don't specify the schema file path, XMLValidating Reader always complains. Validation Event Handler = delegate (object sender, Validation Events Args vargs) ; using (Xml Reader reader = Xml Reader. NET 1.1 then you need Xml Validating Reader for validation but you can set the schema(s) similar to the above code.
Xml Reader Settings reader Settings = new Xml Reader Settings(); reader Settings.
I've been doing some validating of documents against an XSD lately.