You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by jo...@apache.org on 2003/12/27 23:09:44 UTC

cvs commit: ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl XSLogicalParser.java

jochen      2003/12/27 14:09:44

  Modified:    src/xs/org/apache/ws/jaxme/xs/impl XSLogicalParser.java
  Log:
  An EntityResolver supplied by the user may now intercept when importing or including external schemas.
  
  Revision  Changes    Path
  1.17      +11 -3     ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
  
  Index: XSLogicalParser.java
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XSLogicalParser.java	18 Nov 2003 06:20:00 -0000	1.16
  +++ XSLogicalParser.java	27 Dec 2003 22:09:44 -0000	1.17
  @@ -91,6 +91,7 @@
   import org.apache.ws.jaxme.xs.xml.XsTSimpleExplicitGroup;
   import org.apache.ws.jaxme.xs.xml.XsTTopLevelElement;
   import org.w3c.dom.Node;
  +import org.xml.sax.EntityResolver;
   import org.xml.sax.InputSource;
   import org.xml.sax.Locator;
   import org.xml.sax.SAXException;
  @@ -241,6 +242,13 @@
           data.setCurrentContentHandler(xsSAXParser);
           XMLReader xr = factory.newXMLReader(isValidating());
           xr.setContentHandler(xsSAXParser);
  +        EntityResolver entityResolver = xr.getEntityResolver();
  +        if (entityResolver != null) {
  +        	InputSource iSource = entityResolver.resolveEntity(pSource.getPublicId(), pSource.getSystemId());
  +        	if (iSource != null) {
  +        		pSource = iSource;
  +        	}
  +        }
           xr.parse(pSource);
           return (XsESchema) xsSAXParser.getBean();
         } finally {
  @@ -422,7 +430,7 @@
     }
   
     private void importSchema(XsESchema pImportingSchema, String pNamespace,
  -                             XsESchema pImportedSchema, Locator pLocator)
  +                            XsESchema pImportedSchema, Locator pLocator)
         throws SAXException, ParserConfigurationException, IOException {
       XsAnyURI impNamespace = pImportedSchema.getTargetNamespace();
       if (pNamespace == null) {
  @@ -449,8 +457,8 @@
     /** <p>Handles xs:import.</p>
      */
     protected void importSchema(XsESchema pImportingSchema,
  -                                String pNamespace, String pSchemaLocation,
  -                                Locator pLocator)
  +                              String pNamespace, String pSchemaLocation,
  +                              Locator pLocator)
         throws SAXException, IOException, ParserConfigurationException {
       if (pSchemaLocation == null) {
         return;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org