You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Barun Kumar Yadav <by...@sapient.com> on 2008/02/01 00:11:08 UTC
Xerces gives General Schema Error | Works with Oracle Parser
> Hi All,
>
> I am trying to moving from Oracle parse to Xerces Parser.
>
> Using the same XSD and XML if I run the code with Oracle Parser it
> does not give me any error, but when I try it with Xerces it gives me
> General Schem Error. The error trace is below
>
> General Schema Error: Schema in
> file:/D:/CPNI/Installs/bea/user_projects/w4WP_workspaces/Untitled/Phas
> e2/resources/config/schema/EDD/jms/Public/test.xsd has a different
> target namespace from the one specified in the instance document :.
> org.xml.sax.SAXParseException: General Schema Error: Schema in
> file:/D:/CPNI/Installs/bea/user_projects/w4WP_workspaces/Untitled/Phas
> e2/resources/config/schema/EDD/jms/Public/test.xsd has a different
> target namespace from the one specified in the instance document :.
> at
> org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
> at
> org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLE
> rror(XMLValidator.java:1821)
> at
> org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar(
> XMLValidator.java:2846)
> at
> org.apache.xerces.validators.common.XMLValidator.parseSchemas(XMLValid
> ator.java:2747)
> at
> org.apache.xerces.validators.common.XMLValidator.bindNamespacesToEleme
> ntAndAttributes(XMLValidator.java:2628)
> at
> org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLV
> alidator.java:1218)
> at
> org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocument
> Scanner.java:1806)
> at
> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispa
> tch(XMLDocumentScanner.java:949)
> at
> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentSc
> anner.java:381)
> at
> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
> at
> com.att.cpni.common.util.TestXercesParser.generateXercesDOM(TestXerces
> Parser.java:33)
> at
> com.att.cpni.common.util.CPNIDomParserTest.testIsMandatoryInputAttrPre
> sent(CPNIDomParserTest.java:136)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> ava:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> orImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
>
>
> The XSD I am using is attached with mail. The generated XML that I am
> using is generated using an XML editor, so I don't expect it to be
> wrong.
>
> <<test.xsd>>
>
> Any ideas what could be the cause?
>
> Thanks
> Barun
RE: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Barun Kumar Yadav <by...@sapient.com>.
This is the Java method performing this operation
public Document generateXercesDOM(String xmlMessage, URL xsdURL) throws
URISyntaxException {
Document document = null;
DOMParser parser = new DOMParser();
try {
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);
//Validator handler = new Validator();
//parser.setErrorHandler(handler);
StringReader str = new StringReader(xmlMessage);
System.out.println("===========================================");
parser.parse(new InputSource(str));
System.out.println("*******************************************");
document = parser.getDocument();
System.out.println("This is the Document " + document);
} catch (SAXNotRecognizedException e) {
System.out.println("This is SAXNotRecognizedException");
e.printStackTrace();
} catch (SAXNotSupportedException e) {
System.out.println("This is SAXNotSupportedException");
e.printStackTrace();
}catch (SAXException e) {
System.out.println("This is SAXException");
e.printStackTrace();
}catch (IOException e) {
System.out.println("This is IOException");
e.printStackTrace();
}
return document;
}
________________________________
From: Barun Kumar Yadav [mailto:byadav@sapient.com]
Sent: Thursday, January 31, 2008 6:11 PM
To: j-users@xerces.apache.org
Subject: Xerces gives General Schema Error | Works with Oracle
Parser
Hi All,
I am trying to moving from Oracle parse to Xerces Parser.
Using the same XSD and XML if I run the code with Oracle Parser
it does not give me any error, but when I try it with Xerces it gives me
General Schem Error. The error trace is below
General Schema Error: Schema in
file:/D:/CPNI/Installs/bea/user_projects/w4WP_workspaces/Untitled/Phase2
/resources/config/schema/EDD/jms/Public/test.xsd
<file:/D:/CPNI/Installs/bea/user_projects/w4WP_workspaces/Untitled/Phase
2/resources/config/schema/EDD/jms/Public/test.xsd> has a different
target namespace from the one specified in the instance document :.
org.xml.sax.SAXParseException: General Schema Error: Schema in
file:/D:/CPNI/Installs/bea/user_projects/w4WP_workspaces/Untitled/Phase2
/resources/config/schema/EDD/jms/Public/test.xsd
<file:/D:/CPNI/Installs/bea/user_projects/w4WP_workspaces/Untitled/Phase
2/resources/config/schema/EDD/jms/Public/test.xsd> has a different
target namespace from the one specified in the instance document :.
at
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
at
org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLErr
or(XMLValidator.java:1821)
at
org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar(XM
LValidator.java:2846)
at
org.apache.xerces.validators.common.XMLValidator.parseSchemas(XMLValidat
or.java:2747)
at
org.apache.xerces.validators.common.XMLValidator.bindNamespacesToElement
AndAttributes(XMLValidator.java:2628)
at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLVal
idator.java:1218)
at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentSc
anner.java:1806)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatc
h(XMLDocumentScanner.java:949)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScan
ner.java:381)
at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at
com.att.cpni.common.util.TestXercesParser.generateXercesDOM(TestXercesPa
rser.java:33)
at
com.att.cpni.common.util.CPNIDomParserTest.testIsMandatoryInputAttrPrese
nt(CPNIDomParserTest.java:136)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
The XSD I am using is attached with mail. The generated XML that
I am using is generated using an XML editor, so I don't expect it to be
wrong.
<<test.xsd>>
Any ideas what could be the cause?
Thanks
Barun
RE: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Prashant Reddy <pr...@pramati.com>.
The information in the Manifest shows you have the right jar on the
disc. But do you have the same jar when you launch your JVM ?
Please see :
http://xerces.apache.org/xerces2-j/faq-general.html#faq-1
With the same classpath as your process execute cmd
'java org.apache.xerces.impl.Version'
The expected output is one line which looks like
"Xerces-J 2.8.1"
(Wihout the quotes)
HTH
-Prashant
On Fri, 2008-02-01 at 10:55 +0530, Barun Kumar Yadav wrote:
> This is the information from the Manifest file from the JAR
>
> Name: org/apache/xerces/impl/Version.class
> Comment: Xerces-J 2.9.1
> Implementation-Title: org.apache.xerces.impl.Version
> Implementation-Version: 2.9.1
> Implementation-Vendor: Apache Software Foundation
> Implementation-URL: http://xerces.apache.org/xerces2-j/
>
>
> I am using JDK 1.5.
>
> Any other reason what could be wrong.
>
> Thanks
> Barun
>
>
>
>
> -----Original Message-----
> From: Mukul Gandhi [mailto:gandhi.mukul@gmail.com]
> Sent: Thursday, January 31, 2008 10:44 PM
> To: j-users@xerces.apache.org
> Subject: Re: Xerces gives General Schema Error | Works with Oracle
> Parser
>
> Hi Barun,
> Please check the Xerces version using the command:
>
> java org.apache.xerces.impl.Version
>
> Which JDK version are you using?
>
> I suspect, your JDK is an old one, causing you to use the Xerces
> available within JDK and not the latest one from Apache.
>
> On Feb 1, 2008 7:38 AM, Barun Kumar Yadav <by...@sapient.com> wrote:
> >
> > I downloaded the latest version of Xerces that I suppose is 2.9.1
> >
> > Thanks
> > Barun
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
RE: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Barun Kumar Yadav <by...@sapient.com>.
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:gandhi.mukul@gmail.com]
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 <by...@sapient.com> wrote:
> The Xerces version is 2.9.1
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Mukul Gandhi <ga...@gmail.com>.
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 <by...@sapient.com> wrote:
> The Xerces version is 2.9.1
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
RE: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Barun Kumar Yadav <by...@sapient.com>.
The Xerces version is 2.9.1
-----Original Message-----
From: Mukul Gandhi [mailto:gandhi.mukul@gmail.com]
Sent: Friday, February 01, 2008 11:21 AM
To: j-users@xerces.apache.org
Subject: Re: Xerces gives General Schema Error | Works with Oracle
Parser
You should be able to find the Xerces JAR in the Eclipse installation
folder. Please put that JAR in the system CLASSPATH and see what
version it gives you. Or just have the location of Xerces JAR in
Eclipse in CLASSPATH.
You should also check on Window's command prompt,
echo %CLASSPATH%
that the CLASSPATH contains only one JAR file from which you are
determining Xerces's version.
On Feb 1, 2008 6:58 PM, Barun Kumar Yadav <by...@sapient.com> wrote:
>
> I am running the program thru Eclipse,
>
> How do I findwhat is the Xerces version used by the code.
>
> Thanks
> Barun
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Mukul Gandhi <ga...@gmail.com>.
You should be able to find the Xerces JAR in the Eclipse installation
folder. Please put that JAR in the system CLASSPATH and see what
version it gives you. Or just have the location of Xerces JAR in
Eclipse in CLASSPATH.
You should also check on Window's command prompt,
echo %CLASSPATH%
that the CLASSPATH contains only one JAR file from which you are
determining Xerces's version.
On Feb 1, 2008 6:58 PM, Barun Kumar Yadav <by...@sapient.com> wrote:
>
> I am running the program thru Eclipse,
>
> How do I findwhat is the Xerces version used by the code.
>
> Thanks
> Barun
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
RE: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Barun Kumar Yadav <by...@sapient.com>.
If I include the same JAR in the Windows classpath it gives me back the
version as 2.9.1.
But since I am using the Eclipse to run the program how can I be very
sure that it is taking the right version. Or should this test be good
enough.
Thanks
Barun
-----Original Message-----
From: Barun Kumar Yadav [mailto:byadav@sapient.com]
Sent: Friday, February 01, 2008 8:28 AM
To: j-users@xerces.apache.org
Subject: RE: Xerces gives General Schema Error | Works with Oracle
Parser
I am running the program thru Eclipse,
How do I findwhat is the Xerces version used by the code.
Thanks
Barun
-----Original Message-----
From: Mukul Gandhi [mailto:gandhi.mukul@gmail.com]
Sent: Friday, February 01, 2008 1:36 AM
To: j-users@xerces.apache.org
Subject: Re: Xerces gives General Schema Error | Works with Oracle
Parser
As Prashant said, I was not asking you to tell us the property of a
specific JAR file on the disk. I want you to determine the Xerces
version which JVM is loading, which can be done as below.
C:\Documents and Settings\gandhimu>java org.apache.xerces.impl.Version
Xerces-J 2.9.1
(the 2nd line is the output I got on my machine).
On Feb 1, 2008 10:55 AM, Barun Kumar Yadav <by...@sapient.com> wrote:
> This is the information from the Manifest file from the JAR
>
> Name: org/apache/xerces/impl/Version.class
> Comment: Xerces-J 2.9.1
> Implementation-Title: org.apache.xerces.impl.Version
> Implementation-Version: 2.9.1
> Implementation-Vendor: Apache Software Foundation
> Implementation-URL: http://xerces.apache.org/xerces2-j/
>
>
> I am using JDK 1.5.
>
> Any other reason what could be wrong.
>
> Thanks
> Barun
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
RE: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Barun Kumar Yadav <by...@sapient.com>.
I am running the program thru Eclipse,
How do I findwhat is the Xerces version used by the code.
Thanks
Barun
-----Original Message-----
From: Mukul Gandhi [mailto:gandhi.mukul@gmail.com]
Sent: Friday, February 01, 2008 1:36 AM
To: j-users@xerces.apache.org
Subject: Re: Xerces gives General Schema Error | Works with Oracle
Parser
As Prashant said, I was not asking you to tell us the property of a
specific JAR file on the disk. I want you to determine the Xerces
version which JVM is loading, which can be done as below.
C:\Documents and Settings\gandhimu>java org.apache.xerces.impl.Version
Xerces-J 2.9.1
(the 2nd line is the output I got on my machine).
On Feb 1, 2008 10:55 AM, Barun Kumar Yadav <by...@sapient.com> wrote:
> This is the information from the Manifest file from the JAR
>
> Name: org/apache/xerces/impl/Version.class
> Comment: Xerces-J 2.9.1
> Implementation-Title: org.apache.xerces.impl.Version
> Implementation-Version: 2.9.1
> Implementation-Vendor: Apache Software Foundation
> Implementation-URL: http://xerces.apache.org/xerces2-j/
>
>
> I am using JDK 1.5.
>
> Any other reason what could be wrong.
>
> Thanks
> Barun
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Mukul Gandhi <ga...@gmail.com>.
As Prashant said, I was not asking you to tell us the property of a
specific JAR file on the disk. I want you to determine the Xerces
version which JVM is loading, which can be done as below.
C:\Documents and Settings\gandhimu>java org.apache.xerces.impl.Version
Xerces-J 2.9.1
(the 2nd line is the output I got on my machine).
On Feb 1, 2008 10:55 AM, Barun Kumar Yadav <by...@sapient.com> wrote:
> This is the information from the Manifest file from the JAR
>
> Name: org/apache/xerces/impl/Version.class
> Comment: Xerces-J 2.9.1
> Implementation-Title: org.apache.xerces.impl.Version
> Implementation-Version: 2.9.1
> Implementation-Vendor: Apache Software Foundation
> Implementation-URL: http://xerces.apache.org/xerces2-j/
>
>
> I am using JDK 1.5.
>
> Any other reason what could be wrong.
>
> Thanks
> Barun
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
RE: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Barun Kumar Yadav <by...@sapient.com>.
This is the information from the Manifest file from the JAR
Name: org/apache/xerces/impl/Version.class
Comment: Xerces-J 2.9.1
Implementation-Title: org.apache.xerces.impl.Version
Implementation-Version: 2.9.1
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xerces.apache.org/xerces2-j/
I am using JDK 1.5.
Any other reason what could be wrong.
Thanks
Barun
-----Original Message-----
From: Mukul Gandhi [mailto:gandhi.mukul@gmail.com]
Sent: Thursday, January 31, 2008 10:44 PM
To: j-users@xerces.apache.org
Subject: Re: Xerces gives General Schema Error | Works with Oracle
Parser
Hi Barun,
Please check the Xerces version using the command:
java org.apache.xerces.impl.Version
Which JDK version are you using?
I suspect, your JDK is an old one, causing you to use the Xerces
available within JDK and not the latest one from Apache.
On Feb 1, 2008 7:38 AM, Barun Kumar Yadav <by...@sapient.com> wrote:
>
> I downloaded the latest version of Xerces that I suppose is 2.9.1
>
> Thanks
> Barun
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Mukul Gandhi <ga...@gmail.com>.
Hi Barun,
Please check the Xerces version using the command:
java org.apache.xerces.impl.Version
Which JDK version are you using?
I suspect, your JDK is an old one, causing you to use the Xerces
available within JDK and not the latest one from Apache.
On Feb 1, 2008 7:38 AM, Barun Kumar Yadav <by...@sapient.com> wrote:
>
> I downloaded the latest version of Xerces that I suppose is 2.9.1
>
> Thanks
> Barun
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
RE: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Barun Kumar Yadav <by...@sapient.com>.
I downloaded the latest version of Xerces that I suppose is 2.9.1
Thanks
Barun
-----Original Message-----
From: Michael Glavassevich [mailto:mrglavas@ca.ibm.com]
Sent: Thursday, January 31, 2008 8:40 PM
To: j-users@xerces.apache.org
Subject: Re: Xerces gives General Schema Error | Works with Oracle
Parser
Barun,
Have you tried the latest version of Xerces? The stack trace you've
posted
shows that you're probably using Xerces 1.4.4 or something more ancient.
Thanks.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
"Barun Kumar Yadav" <by...@sapient.com> wrote on 01/31/2008 06:11:08
PM:
> Hi All,
> I am trying to moving from Oracle parse to Xerces Parser.
> Using the same XSD and XML if I run the code with Oracle Parser it
> does not give me any error, but when I try it with Xerces it gives
> me General Schem Error. The error trace is below
> General Schema Error: Schema in file:/D:
>
/CPNI/Installs/bea/user_projects/w4WP_workspaces/Untitled/Phase2/resourc
es/config/schema/EDD/jms/Public/test.
> xsd has a different target namespace from the one specified in the
> instance document :.
> org.xml.sax.SAXParseException: General Schema Error: Schema in file:
> /D:
>
/CPNI/Installs/bea/user_projects/w4WP_workspaces/Untitled/Phase2/resourc
es/config/schema/EDD/jms/Public/test.
> xsd has a different target namespace from the one specified in the
> instance document :.
> at org.apache.xerces.framework.XMLParser.reportError(
> XMLParser.java:1213)
> at org.apache.xerces.validators.common.XMLValidator.
> reportRecoverableXMLError(XMLValidator.java:1821)
> at org.apache.xerces.validators.common.XMLValidator.
> resolveSchemaGrammar(XMLValidator.java:2846)
> at
org.apache.xerces.validators.common.XMLValidator.parseSchemas(
> XMLValidator.java:2747)
> at org.apache.xerces.validators.common.XMLValidator.
> bindNamespacesToElementAndAttributes(XMLValidator.java:2628)
> at
org.apache.xerces.validators.common.XMLValidator.callStartElement(
> XMLValidator.java:1218)
> at org.apache.xerces.framework.XMLDocumentScanner.scanElement(
> XMLDocumentScanner.java:1806)
> at org.apache.xerces.framework.
>
XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:94
9)
> at org.apache.xerces.framework.XMLDocumentScanner.parseSome(
> XMLDocumentScanner.java:381)
> at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
> at
com.att.cpni.common.util.TestXercesParser.generateXercesDOM(
> TestXercesParser.java:33)
> at com.att.cpni.common.util.CPNIDomParserTest.
> testIsMandatoryInputAttrPresent(CPNIDomParserTest.java:136)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
>
> The XSD I am using is attached with mail. The generated XML that I
> am using is generated using an XML editor, so I don't expect it to be
wrong.
> <<test.xsd>>
> Any ideas what could be the cause?
> Thanks
> Barun [attachment "test.xsd" deleted by Michael
Glavassevich/Toronto/IBM]
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Xerces gives General Schema Error | Works with Oracle Parser
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Barun,
Have you tried the latest version of Xerces? The stack trace you've posted
shows that you're probably using Xerces 1.4.4 or something more ancient.
Thanks.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
"Barun Kumar Yadav" <by...@sapient.com> wrote on 01/31/2008 06:11:08 PM:
> Hi All,
> I am trying to moving from Oracle parse to Xerces Parser.
> Using the same XSD and XML if I run the code with Oracle Parser it
> does not give me any error, but when I try it with Xerces it gives
> me General Schem Error. The error trace is below
> 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 :.
> org.xml.sax.SAXParseException: 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 :.
> at org.apache.xerces.framework.XMLParser.reportError(
> XMLParser.java:1213)
> at org.apache.xerces.validators.common.XMLValidator.
> reportRecoverableXMLError(XMLValidator.java:1821)
> at org.apache.xerces.validators.common.XMLValidator.
> resolveSchemaGrammar(XMLValidator.java:2846)
> at org.apache.xerces.validators.common.XMLValidator.parseSchemas(
> XMLValidator.java:2747)
> at org.apache.xerces.validators.common.XMLValidator.
> bindNamespacesToElementAndAttributes(XMLValidator.java:2628)
> at
org.apache.xerces.validators.common.XMLValidator.callStartElement(
> XMLValidator.java:1218)
> at org.apache.xerces.framework.XMLDocumentScanner.scanElement(
> XMLDocumentScanner.java:1806)
> at org.apache.xerces.framework.
>
XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:949)
> at org.apache.xerces.framework.XMLDocumentScanner.parseSome(
> XMLDocumentScanner.java:381)
> at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
> at com.att.cpni.common.util.TestXercesParser.generateXercesDOM(
> TestXercesParser.java:33)
> at com.att.cpni.common.util.CPNIDomParserTest.
> testIsMandatoryInputAttrPresent(CPNIDomParserTest.java:136)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
>
> The XSD I am using is attached with mail. The generated XML that I
> am using is generated using an XML editor, so I don't expect it to be
wrong.
> <<test.xsd>>
> Any ideas what could be the cause?
> Thanks
> Barun [attachment "test.xsd" deleted by Michael Glavassevich/Toronto/IBM]
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org