Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with XMLSchema Validation ...

Status
Not open for further replies.

rm200471

Programmer
Aug 4, 2005
1
DE
Hi!

I have an XmlSchema, very simple.

<xs:schema xmlns:xs=" elementFormDefault="qualified" attributeFormDefault="qualified" xmlns:gib="<xs:element name="eigenshaftenElement">
<xs:complexType>
<xs:attribute name="attr1" gib:name="Prozessor" gib:description="Central Processing Unit Processor" use="required" gib:schemaType="variant" gib:eek:rder="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="AMD2" gib:description="AMD Celeron +220"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="attr3" gib:name="Festplattegroesse" gib:description="Size of the hard disk" use="required" gib:schemaType="variant" gib:eek:rder="3" type="xs:integer"/>
</xs:complexType>
</xs:element>
</xs:schema>

This schema is loaded and stored in XMLSchemaCache instance.
Then I load a very, very simple document (objXml),
using a FreeThreadedDOMDocument40 (named objDoc) instance.

objXml is

<gibxd:eigenshaftenElement xmlns:gibxd="gibxd"/>

Then I assign to the objDoc.schemas the above XMLSchemaCache.

Then I call objDoc.validate

The following error message occurs:

"Required attribute 'gibxd:attr1' is missing."

which is correct.

I fill the gibxd:attr1 and results the
following objXml

<gibxd:eigenshaftenElement xmlns:gibxd="gibxd" gibxd:attr1="AMD2"/>

I call again the objDoc.validate

The following error occurs:

"The attribute 'attr1' on this element is not defined in the DTD/Schema."

Could anyone explain me, why?

Thanks,

Radu Mirescu (programmer)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top