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]

Reply via email to