Doug wrote:
<xs:schema id="XmlCommand " elementFormDefa ult="qualified"
version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace ="http://intranet/hstServices/Schemas/XmlCommand.xsd"
xmlns="http://intranet/hstServices/Schemas/XmlCommand.xsd"
xmlns:NS="http://intranet/hstServices/Schemas/XmlCommand.xsd" >
<xs:attribute name="name" type="xs:string " />
<xs:element name="XmlComman d">
So this schema defines an XmlCommand element in its targetNamespace
which is
http://intranet/hstServices/Schemas/XmlCommand.xsd.
Your XML sample however has
<XmlCommand connectionKey=' dbStarrs'>
an XmlCommand element in no namespace. What happens in this case is the
the XML parser looks at the root element, finds it is in no namespace
and then looks for a schema for no namespace. It does not have one
however and that way it simply does lax validation only.
If you set up an XmlReader with a ValidationEvent Handler to report
warnings then you will get a warning that the parser does not find a
schema. However the design of the Validate method you are using is a bit
flawed as it does not allow you to get warnings, it only reports errors.
See also
<http://blogs.msdn.com/xmlteam/archive/2007/04/02/to-trust-or-not-to-trust.aspx>
which recommends "DO TURN ON the ReportValidatio nWarnings flag".
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/