You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2005/06/21 17:11:57 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/jaxp DocumentBuilderFactoryImpl.java

mrglavas    2005/06/21 08:11:57

  Modified:    java/src/org/apache/xerces/jaxp
                        DocumentBuilderFactoryImpl.java
  Log:
  When creating a DocumentBuilder, check that if a Schema has been specified that neither of the schema properties have been set.
  
  Revision  Changes    Path
  1.19      +16 -1     xml-xerces/java/src/org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.java
  
  Index: DocumentBuilderFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DocumentBuilderFactoryImpl.java	19 Jun 2005 21:29:41 -0000	1.18
  +++ DocumentBuilderFactoryImpl.java	21 Jun 2005 15:11:57 -0000	1.19
  @@ -25,6 +25,7 @@
   import javax.xml.parsers.ParserConfigurationException;
   import javax.xml.validation.Schema;
   
  +import org.apache.xerces.dom.DOMMessageFormatter;
   import org.apache.xerces.parsers.DOMParser;
   import org.apache.xerces.util.SAXMessageFormatter;
   import org.xml.sax.SAXException;
  @@ -55,6 +56,20 @@
       public DocumentBuilder newDocumentBuilder()
           throws ParserConfigurationException 
       {
  +        /** Check that if a Schema has been specified that neither of the schema properties have been set. */
  +        if (grammar != null && attributes != null) {
  +            if (attributes.containsKey(JAXPConstants.JAXP_SCHEMA_LANGUAGE)) {
  +                throw new ParserConfigurationException(
  +                        SAXMessageFormatter.formatMessage(null, 
  +                        "schema-already-specified", new Object[] {JAXPConstants.JAXP_SCHEMA_LANGUAGE}));
  +            }
  +            else if (attributes.containsKey(JAXPConstants.JAXP_SCHEMA_SOURCE)) {
  +                throw new ParserConfigurationException(
  +                        SAXMessageFormatter.formatMessage(null, 
  +                        "schema-already-specified", new Object[] {JAXPConstants.JAXP_SCHEMA_SOURCE}));                
  +            }
  +        }
  +        
           try {
               return new DocumentBuilderImpl(this, attributes, features, fSecureProcess);
           } catch (SAXException se) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org