- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Mon, 3 Dec 2001 12:24:06 +0000
- To: Nathalie Furmento <n.furmento@doc.ic.ac.uk>
- CC: xmlschema-dev@w3.org
Hi Nathalie, > I have a problem when trying to parse a document with the validation > feature switched on. It's working without problems if the validation > is turned off, but when i switch it on (i am using > xerces-2_0_0_beta3), i got the following error: > > org.xml.sax.SAXException: cvc-elt.1: Cannot find the declaration of > element 'person'. It's probably to do with the XML Schema namespace declarations. The XML Schema instance namespace should be http://www.w3.org/2001/XMLSchema-instance (you've got '1999' rather than '2001') so change the instance document to: <?xml version="1.0" encoding="UTF-8"?> <person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="person.xsd"> <name>Isabelle</name> <age>1234</age> </person> And the elements in the XML Schema document need to be in the XML Schema namespace of http://www.w3.org/2001/XMLSchema. Since the schema doesn't have a target namespace, I'd declare this with a prefix rather than use the default namespace, so try: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="age" type="xs:decimal"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Monday, 3 December 2001 07:24:08 UTC