Dan Bass wrote:
There's an XML message I have, that has no namespace information.
Then there is a XSD schema that is must validate against, but this has a
targetNamespace and xmlns of "http://www.wbf.org/xml/b2mml-v02".
How do I get this XML to validate against the Schema in C#?
<?xml version="1.0" encoding="UTF-8"?>
<ProductionSchedule>
Which must be validated against the XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.wbf.org/xml/b2mml-v02"
xmlns="http://www.wbf.org/xml/b2mml-v02"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:element name="ProductionSchedule" type="ProductionScheduleType"/>
Well the validation should tell you that the XML is not valid according
to the schema, if you want a file that is valid according to the schema
then you need to have
<ProductionSchedule xmlns="http://www.wbf.org/xml/b2mml-v02">
or
<ex:ProductionSchedule xmlns:ex="http://www.wbf.org/xml/b2mml-v02">
It is as simple as that, if the schema defines the element
ProductionSchedule to be in a certain namespace then any XML instance
having the element in the null namespace or another namespace is not
valid according to the schema.
So you need to either change the schema or the XML instance file if you
want the XML instance to be valid according to the schema.
--
Martin Honnen
http://JavaScript.FAQTs.com/