You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ed...@apache.org on 2002/01/23 00:29:09 UTC

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

edwingo     02/01/22 15:29:09

  Modified:    java/src/org/apache/xerces/jaxp
                        DocumentBuilderFactoryImpl.java
  Log:
  Removed workaround for previous Beta3 code which is no longer needed and
  causes additional bugs in combination w/ other apache properties.  Calling
  setAttribute(name, value) w/ a value of null, causes name to be unset.
  
  Revision  Changes    Path
  1.11      +18 -13    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DocumentBuilderFactoryImpl.java	12 Dec 2001 03:28:08 -0000	1.10
  +++ DocumentBuilderFactoryImpl.java	22 Jan 2002 23:29:09 -0000	1.11
  @@ -1,5 +1,5 @@
   /*
  - * $Id: DocumentBuilderFactoryImpl.java,v 1.10 2001/12/12 03:28:08 edwingo Exp $
  + * $Id: DocumentBuilderFactoryImpl.java,v 1.11 2002/01/22 23:29:09 edwingo Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -77,18 +77,9 @@
       /** These are DocumentBuilderFactory attributes not DOM attributes */
       private Hashtable attributes;
   
  -    public DocumentBuilderFactoryImpl() {
  -        // Set the default schema language to DTD
  -        try {
  -            setAttribute(DocumentBuilderImpl.JAXP_SCHEMA_LANGUAGE, "DTD");
  -        } catch (IllegalArgumentException x) {
  -            // Assume this is b/c parser does not support this feature and
  -            // so we just ignore it
  -        }
  -    }
  -
       /**
  -     * 
  +     * Creates a new instance of a {@link javax.xml.parsers.DocumentBuilder}
  +     * using the currently configured parameters.
        */
       public DocumentBuilder newDocumentBuilder()
           throws ParserConfigurationException 
  @@ -104,15 +95,29 @@
       /**
        * Allows the user to set specific attributes on the underlying 
        * implementation.
  +     * @param name    name of attribute
  +     * @param value   null means to remove attribute
        */
       public void setAttribute(String name, Object value)
           throws IllegalArgumentException
       {
  -        // XXX This is ugly.  We have to collect the attributes and then
  +        // This handles removal of attributes
  +        if (value == null) {
  +            if (attributes != null) {
  +                attributes.remove(name);
  +            }
  +            // Unrecognized attributes do not cause an exception
  +            return;
  +        }
  +        
  +        // This is ugly.  We have to collect the attributes and then
           // later create a DocumentBuilderImpl to verify the attributes.
  +
  +        // Create Hashtable if none existed before
           if (attributes == null) {
               attributes = new Hashtable();
           }
  +
           attributes.put(name, value);
   
           // Test the attribute name by possibly throwing an exception
  
  
  

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