mrglavas    2004/01/21 15:09:09

  Modified:    java/src/org/apache/xerces/util
                        DOMEntityResolverWrapper.java
  Log:
  We're required to report "http://www.w3.org/2001/XMLSchema"; as the type 
  for XML schema as per the DOM L3 LS CR. Since we don't have a type field
  on the resource identifier, we can check that the identifier is grammar
  description and then get its type.
  
  
http://www.w3.org/TR/2003/CR-DOM-Level-3-LS-20031107/load-save.html#LS-LSResourceResolver
  
  Revision  Changes    Path
  1.9       +18 -3     
xml-xerces/java/src/org/apache/xerces/util/DOMEntityResolverWrapper.java
  
  Index: DOMEntityResolverWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/util/DOMEntityResolverWrapper.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DOMEntityResolverWrapper.java     24 Dec 2003 16:24:21 -0000      1.8
  +++ DOMEntityResolverWrapper.java     21 Jan 2004 23:09:09 -0000      1.9
  @@ -60,6 +60,7 @@
   
   import org.apache.xerces.xni.XNIException;
   import org.apache.xerces.xni.XMLResourceIdentifier;
  +import org.apache.xerces.xni.grammars.XMLGrammarDescription;
   import org.apache.xerces.xni.parser.XMLEntityResolver;
   import org.apache.xerces.xni.parser.XMLInputSource;
   
  @@ -90,7 +91,10 @@
       //
   
       /** XML 1.0 type constant according to DOM L3 LS CR spec 
"http://www.w3.org/TR/2003/CR-DOM-Level-3-LS-20031107"; */
  -    private static final String XML_TYPE="http://www.w3.org/TR/REC-xml";;
  +    private static final String XML_TYPE = "http://www.w3.org/TR/REC-xml";;
  +    
  +    /** XML Schema constant according to DOM L3 LS CR spec 
"http://www.w3.org/TR/2003/CR-DOM-Level-3-LS-20031107"; */
  +    private static final String XSD_TYPE = "http://www.w3.org/2001/XMLSchema";;
   
       /** The DOM entity resolver. */
       protected LSResourceResolver fEntityResolver;
  @@ -150,7 +154,7 @@
                               null,
                               null)
                           : fEntityResolver.resolveResource(
  -                            XML_TYPE,
  +                            getType(resourceIdentifier),
                               resourceIdentifier.getNamespace(),
                               resourceIdentifier.getPublicId(),
                               resourceIdentifier.getLiteralSystemId(),
  @@ -194,5 +198,16 @@
           return null;
   
       } // resolveEntity(String,String,String):XMLInputSource
  +    
  +    /** Determines the type of resource being resolved **/
  +    private String getType(XMLResourceIdentifier resourceIdentifier) {
  +        if (resourceIdentifier instanceof XMLGrammarDescription) {
  +            XMLGrammarDescription desc = (XMLGrammarDescription) resourceIdentifier;
  +            if (desc.getGrammarType() == XMLGrammarDescription.XML_SCHEMA) {
  +                return XSD_TYPE;
  +            }
  +        }
  +        return XML_TYPE;
  +    } // getType(XMLResourceIdentifier):String
       
   } // DOMEntityResolverWrapper
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to