j***@yahoo.com
2006-02-16 17:26:04 UTC
I have posted the XML file and the schema file generated using XSD.exe.
When I try to validate using (C#) I get the following error.
XML Validation error: The element cannot contain text or white space.
Content model is empty. An error occurred at
file:///c:/HouseReport_2006-02-14.fpr.xml, (3, 59).
Pls note the following
<Criteria Var1="5393" Var2="2006-02-14">
</Criteria>
If I change the above line as follows, then the error goes away. But I
don't want to change the XML file because it is coming from an external
source.
<Criteria Var1="5393" Var2="2006-02-14"> </Criteria>
XML File :
<?xml version="1.0" encoding="utf-8"?>
<PostHouseReport xmlns = "SchemaFile.xsd" >
<Criteria Var1="5393" Var2="2006-02-14">
</Criteria>
<Houses>
<House HouseNo="33" HouseStatus="CLER">
<Nm last="Joe3" first="Don2" mid="C" suf="">
</Nm>
</House>
<House HouseNo="44" HouseStatus="CLER">
<Nm last="Joe4" first="DOn1" mid="" suf="">
</Nm>
</House>
</Houses>
</PostHouseReport>
Schema File :
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="HouseReport" elementFormDefault="qualified"
targetNamespace="Schwab/CLEARS/HouseReport.xsd"
xmlns="SchemaFile.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="HouseReport" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Criteria">
<xs:complexType>
<xs:attribute name="Var1" type="xs:string" />
<xs:attribute name="Var2" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Houses">
<xs:complexType>
<xs:sequence>
<xs:element name="House" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Nm" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="last" type="xs:string" />
<xs:attribute name="first" type="xs:string" />
<xs:attribute name="mid" type="xs:string" />
<xs:attribute name="suf" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="HouseNo" type="xs:string" />
<xs:attribute name="HouseStatus" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
When I try to validate using (C#) I get the following error.
XML Validation error: The element cannot contain text or white space.
Content model is empty. An error occurred at
file:///c:/HouseReport_2006-02-14.fpr.xml, (3, 59).
Pls note the following
<Criteria Var1="5393" Var2="2006-02-14">
</Criteria>
If I change the above line as follows, then the error goes away. But I
don't want to change the XML file because it is coming from an external
source.
<Criteria Var1="5393" Var2="2006-02-14"> </Criteria>
XML File :
<?xml version="1.0" encoding="utf-8"?>
<PostHouseReport xmlns = "SchemaFile.xsd" >
<Criteria Var1="5393" Var2="2006-02-14">
</Criteria>
<Houses>
<House HouseNo="33" HouseStatus="CLER">
<Nm last="Joe3" first="Don2" mid="C" suf="">
</Nm>
</House>
<House HouseNo="44" HouseStatus="CLER">
<Nm last="Joe4" first="DOn1" mid="" suf="">
</Nm>
</House>
</Houses>
</PostHouseReport>
Schema File :
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="HouseReport" elementFormDefault="qualified"
targetNamespace="Schwab/CLEARS/HouseReport.xsd"
xmlns="SchemaFile.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="HouseReport" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Criteria">
<xs:complexType>
<xs:attribute name="Var1" type="xs:string" />
<xs:attribute name="Var2" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Houses">
<xs:complexType>
<xs:sequence>
<xs:element name="House" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Nm" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="last" type="xs:string" />
<xs:attribute name="first" type="xs:string" />
<xs:attribute name="mid" type="xs:string" />
<xs:attribute name="suf" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="HouseNo" type="xs:string" />
<xs:attribute name="HouseStatus" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>