Thats right the work around gives not NPE.
I dont think it is a onerous workaround.
Only thing is, it is not back ward compatiable. If somebody like me already had a Entity resolver with version 1.3.0 then it would not work with 1.4.x.
Tushar.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 24, 2001 2:09 PM
To: [EMAIL PROTECTED]
Subject: RE: Problem using EntityResolver
Hi Tushar,
So it sounds like you're saying that if you set the publicId/systemId then
you don't get NPE's?
I'm certainly willing to accept that this is a bug, but this doesn't
exactly sound like an onerous workaround... Does this make your life
particularly difficult for some reason?
Cheers,
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone: 416-448-3519, T/L 778-3519
E-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED] on 08/24/2001 01:44:11 PM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: RE: Problem using EntityResolver
hi Neil,
Thanks for your help.
In my class which implements Entity Resolver I have to set the SystemId
for the InputSource explicitly. If I do not set it then it will work fine
as long as you do not have any include or import statements. If there are
any import statements and if you do not set this property for the
Inputsource than it would fail.
Tushar
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 23, 2001 6:08 PM
To: [EMAIL PROTECTED]
Subject: RE: Problem using EntityResolver
Hi Tushar,
It isn't obvious to me what's going wrong here. Have you tried Xerces
1.4.3? When the parser requests the original schema document--the one
doing the importing--do you provide it with an InputSource? Is the
systemId or publicId on the InputSource set? If not, you could try doing
that and seeing if this helps; I have a feeling it might.
Cheers,
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone: 416-448-3519, T/L 778-3519
E-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED] on 08/23/2001 11:00:59 AM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: RE: Problem using EntityResolver
I checked It does not return NULL.
I open the source code put the debug statements in openImportedSchema
method and
it tries to see a circular dependency of the import schema and itself. But
itself is null i.e.(fCurrentSchemaURL)
Has any one been successfule to use Entity Resolver with schemas and import
clause in schema?
Tushar.
private Element openImportedSchema(String location) throws Exception {
// expand it before passing it to the parser
InputSource source = null;
System.out.println("Location "+ location + "Current Schema "
+fCurrentSchemaURL);
if (fEntityResolver != null) {
source = fEntityResolver.resolveEntity("", location);
}
if (source == null) {
location = expandSystemId(location, fCurrentSchemaURL);
source = new InputSource(location);
}
else {
// create a string for uniqueness of this imported schema in
fImportLocations
if (source.getPublicId () != null)
location = source.getPublicId ();
location += (',' + source.getSystemId ());
}
if (fImportLocations.contains((Object)location)) {
System.out.println("fImportLocations.contains((Object)location");
return null;
}
// check to make sure we're not importing ourselves...
if(source.getSystemId().equals(fCurrentSchemaURL)) {
// REVISIT: localize
System.out.println("// REVISIT:localize");
return null;
}
-----Original Message-----
From: Menarek John-NJM010 [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 23, 2001 10:51 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Problem using EntityResolver
In your entity resolver class are you sure that you are not returning
a NULL?
Either by falling through to the default behaviour of the else block.
Or that your catch statement is catching a FileNotFoundException.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 3:31 PM
To: [EMAIL PROTECTED]
Subject: Problem using EntityResolver
Xerces 1.4.2:
When I try to parse a document with xml files and schema files in
the same directory. The parsing works fine.
But Instead if Iset my own EntityResolver in the parser it fails.
I have included SourceCode for Parser, Resolver.
If you need I can provide you with the XML and xsd files.
Also the Stack Trace is
java.lang.NullPointerException
at
org.apache.xerces.validators.schema.TraverseSchema.openImportedSchema(TraverseSchema.java:2045)
at
org.apache.xerces.validators.schema.TraverseSchema.traverseImport(TraverseSchema.java:1995)
at
org.apache.xerces.validators.schema.TraverseSchema.doTraverseSchema(TraverseSchema.java:720)
at
org.apache.xerces.validators.schema.TraverseSchema.<init>(TraverseSchema.java:540)
at
org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar(XMLValidator.java:2787)
at
org.apache.xerces.validators.common.XMLValidator.parseSchemas(XMLValidator.java:2673)
at
org.apache.xerces.validators.common.XMLValidator.bindNamespacesToElementAndAttributes(XMLValidator.java:2614)
at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1152)
at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1862)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1005)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1122)
at sax.SAX2Writer.print(SAX2Writer.java:153)
at sax.SAX2Writer.main(SAX2Writer.java:444)
<<SoapResolver.java>> <<SAX2Writer.java>>
--------------------------------------------------------------
Tushar Dave
Employease Inc.
Phone: 404-949-8833 (NEW)
Email: [EMAIL PROTECTED]
--------------------------------------------------------------
---------------------------------------------------------------------
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]
