Check the namespace you are using for schema.
If you are using xerces-j-1.4.0 then you should use
"http://www.w3.org/2001/XMLSchema" instead of
"http://www.w3.org/2000/10/XMLSchema".
This type of problem viz. "Element not declared" usually occurs because of using
incorrect namespace.
Rahul.
> Subject: Problem in schema validation
> To: [EMAIL PROTECTED], [EMAIL PROTECTED]
> From: [EMAIL PROTECTED]
> Date: Mon, 25 Jun 2001 09:28:42 +0530
>
> Hello All
>
> I do not know whether i am posting this query in proper forum or not. if i
> am wrong, Pls tell me the right forum for posting query mails.
>
> I am facing a problem. I am trying to validate a xml file against a schema
> xsd file.
>
> code is some thing like this -
>
> >>>>
>
> SAXParser parser = new SAXParser();
>
> parser.setErrorHandler (this);
>
> parser.setFeature("http://xml.org/sax/features/validation",true);
>
> parser.setFeature ("http://apache.org/xml/features/validation/schema",
> true);
>
> parser.parse(xmlFile);
>
> <<<<<
>
> Error handler is defined in the same program.
>
> When i am running this program, it is thorwing error like -
>
> >>>
>
> Error: org.xml.sax.SAXParseException: Element type "attribute" must be
> declared.
>
> Error: org.xml.sax.SAXParseException: Attribute "name" must be declared
> for element type "attribute".
>
> <<<
>
> And this type of error message is comming for every elemets and attributes
> in xml file.
>
> Can someone tell me the problem area.
>
> Thanks in advance for any help
>
>
> Brajendra Singh
>
> Brajendra Singh
> Software Engineer
> Max Ateev Limited
> A 26/2, Mohan Cooperative Indstl. Area
> New Delhi - 110044
> Tel: +91 11 6950410 Ext. 172
> Fax: +91 11 6950400
> www.maxateev.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]