I want to do XML validation to validate whether an input XML file conforming to a schema file (.xsd). My question is when do we need to specify the target namespace parameter and what is the function of the target namespace parameter?
I got this question from the following MSDN pages,
More specifically, I am referring to the 1st parameter of Add method of XmlSchemaSet class.
My current confusions are, please help to review whether my understanding in 1 and 2 are both correct, and help to answer question 3 and 4.
1. In the XML schema file, there is a target namespace attribute at top, and all elements defined in this XML schema file are defined in the target namespace;
2. In the XML document file to check against scheme, the XML document may use elements defined in the "target namespace" of the XML schema file, and may also use elements from other namespaces other than the "target namespace" defined in the XML schema file;
3. Question is, should we just add the "target namespace" to the Add method of XmlSchemaSet class, or add all namespaces which the XML document will use to the Add method of XmlSchemaSet class?
4. Another question is, whether we could define multiple "target namespace" in the XML schema file? If yes, how?