I was mixing up too many things, finally cleared up the things and this
is the exact problem that I am facing now.

If in the XML document I have these two features set then the parser
works fine 
xsi:schemaLocation="http://abc.com/xyz.xsd d:/xyz.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

But since the XML document we are receiving in the application is third
party and don't really have much control on the XML. The XML that we are
receiving does not have these two features set. Would like to set things
from our side. So just wanted to know, if there is something that can be
done from the code so that the parser works fine.

The code that I have written goes like this 

DOMParser parser = new DOMParser();
parser.setFeature("http://xml.org/sax/features/validation",true);
parser.setFeature("http://apache.org/xml/features/validation/schema";,
true);
parser.setFeature("http://apache.org/xml/features/validation/schema-full
-checking",true);
parser.setProperty("http://apache.org/xml/properties/schema/external-noN
amespaceSchemaLocation",
                                        xsdURL.toURI().toString());

ErrorHandler handler = new ParserErrorHandler();
parser.setErrorHandler(handler);
parser.parse(new InputSource(new StringReader(xmlMessage)));
document = parser.getDocument();

Is that the right way to do or should I be approaching the things in a
different manner. 

(The error that I get is cvc-elt.1: Cannot find the declaration of
element 'xyz'.)

Thanks
Barun

 

-----Original Message-----
From: Mukul Gandhi [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 03, 2008 3:12 AM
To: j-users@xerces.apache.org
Subject: Re: Xerces gives General Schema Error | Works with Oracle
Parser

So, you do are using the latest Xerces version. That's good.

Coming back to your original query. The error message you get is:

General Schema Error: Schema in
file:/D:/CPNI/Installs/bea/user_projects/w4WP_workspaces/Untitled/Phase2
/resources/config/schema/EDD/jms/Public/test.xsd
has a different target namespace from the one specified in the
instance document

I think, the error message correctly points to the error.

For the XML Schema validator to correctly validate the XML documents
in a namespace, the correct target namespace value should be used in
the XML Schema.

On Feb 3, 2008 11:05 AM, Barun Kumar Yadav <[EMAIL PROTECTED]> wrote:
> The Xerces version is 2.9.1


-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
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]

Reply via email to