Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Validation problem in XMLValidatingReader

From: "Khawar" <khawar.ahmad@-----.--->
To: NULL
Date: 4/6/2005 7:44:00 AM
Hi!
I need to validate this xml file
--------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<ElementGroup1A xmlns= "http://tempuri.org/XMLSchema.xsd">
	<Na></Na>
	<Li></Li>
</ElementGroup1A>
---------------------------------------------
according to this schema
-----------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
                  elementFormDefault="qualified"
                  xmlns="http://tempuri.org/XMLSchema.xsd"
                  xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
                  xmlns:xs="http://www.w3.org/2001/XMLSchema">
                  <xs:element name="ElementGroup1A">
		<xs:complexType mixed="true">
			<xs:choice>

				<xs:element ref="SodiumFamily"></xs:element>
				<xs:element ref="H"></xs:element>
			</xs:choice>
		</xs:complexType>
	</xs:element>
	<xs:element name="H"></xs:element>
	<xs:element name="Na"></xs:element>
	<xs:element name="Li"></xs:element>
	<xs:element name="Ca"></xs:element>
	<xs:element name="SodiumFamily">
		<xs:complexType mixed="true">
			<xs:choice>
				<xs:element ref="Na"></xs:element>
				<xs:element ref="Li"></xs:element>
				<xs:element ref="Ca"></xs:element>
			</xs:choice>
		</xs:complexType>
	</xs:element>
</xs:schema>
------------------------------------------------------------
I am using XMLValidatingReader as
-------------------------------------------------------------
Dim v As New Xml.XmlValidatingReader(TextArea.Text,
Xml.XmlNodeType.Element, Nothing)
v.Schemas.Add("http://tempuri.org/XMLSchema.xsd", "XMLSchema.xsd")
v.ValidationType = Xml.ValidationType.Schema
AddHandler v.ValidationEventHandler, AddressOf errorDetector
While v.Read : End While
-----------------------------------------------------------------------
but validator finds following validation errors in the XML
------------------------------------------------------------
The element 'http://tempuri.org/XMLSchema.xsd:ElementGroup1A' has
invalid child element 'http://tempuri.org/XMLSchema.xsd:Na'. Expected
'http://tempuri.org/XMLSchema.xsd:SodiumFamily
http://tempuri.org/XMLSchema.xsd:H'. An error occurred at , (3, 3).
--------------------------------------------------------------
You can see XMLValidatingReader is taking SodiumFamily as an element
rather than a block of element.Is there any way that i can compell
XMLValidatingReader to differntiate between element and block of
elements or is there any modification i can do in schema.

Regards,
Khawar



transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent