Hello
I have the following problem.
I want to use the validating parser XmlValidatingReader and so I write ...
FileStream stream = new FileStream(ofd.FileName, FileMode.Open);
XmlValidatingReader rdr = new XmlValidatingReader(
stream, XmlNodeType.Element, null);
rdr.ValidationEventHandler += eventHandler;
rdr.ValidationType = ValidationType.Auto;
doc = new XmlDocument();
doc.Load(rdr);
This program works without a little exception.
I have a xsd-file - well formed and valid - and a xml-file based on that
xsd, well formed and valid too, both written and testet with atova xml spy.
But instead of this, the XmlValidatingReader throws errors. In the
eventhandler i get a message, that (translated from German) "Keyref
cannot find the 'key'- or 'unique'-Element, which is pointed out by
'selectionParameter'."
Independently of the problem - it is an xml-Problem and off Topic here -
I'm interested in writing a proper error message which contains the line
number of the xml file which produces the error. The xml-file has more
than 1000 lines and it is not a good idea to say "Somewhere in that file
there is something wrong"
Can you give me a hint to improve the quality of my error message.
Thanks and best regards
Wolfgang Uhr