You are viewing a plain text version of this content. The canonical link for it is here.
Posted to crimson-cvs@xml.apache.org by ed...@apache.org on 2001/03/09 02:04:29 UTC

cvs commit: xml-crimson/src/org/apache/crimson/jaxp DocumentBuilderImpl.java

edwingo     01/03/08 17:04:29

  Modified:    src/org/apache/crimson/tree XmlDocumentBuilder.java
                        ElementNode2.java AttributeSet.java
               src/org/apache/crimson/parser/resources Messages.properties
               src/org/apache/crimson/parser Parser2.java
               src/org/apache/crimson/jaxp DocumentBuilderImpl.java
  Added:       src/org/apache/crimson/tree XmlDocumentBuilder2.java
  Log:
  Fix namespaceAware property of DocumentBuilder to be in line with the
  JAXP 1.1 spec
  
  Revision  Changes    Path
  1.5       +17 -54    xml-crimson/src/org/apache/crimson/tree/XmlDocumentBuilder.java
  
  Index: XmlDocumentBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-crimson/src/org/apache/crimson/tree/XmlDocumentBuilder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XmlDocumentBuilder.java	2001/02/24 03:23:45	1.4
  +++ XmlDocumentBuilder.java	2001/03/09 01:04:26	1.5
  @@ -1,5 +1,5 @@
   /* 
  - * $Id: XmlDocumentBuilder.java,v 1.4 2001/02/24 03:23:45 edwingo Exp $
  + * $Id: XmlDocumentBuilder.java,v 1.5 2001/03/09 01:04:26 edwingo Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -127,28 +127,33 @@
    * than matching an XML structure that may not be optimized appropriately.
    *
    * @author David Brownell
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class XmlDocumentBuilder implements ContentHandler, LexicalHandler,
       DeclHandler, DTDHandler
   {
       // used during parsing
  -    private XmlDocument		document;
  -    private Locator		locator;
  +    protected XmlDocument		document;
  +    protected Locator		locator;
       private Locale		locale = Locale.getDefault ();
   
       private ElementFactory	factory;
       private Vector		attrTmp = new Vector ();
       
  -    private ParentNode		elementStack [];
  -    private int         	topOfStack;
  +    protected ParentNode        elementStack[];
  +    protected int         	topOfStack;
       private boolean		inDTD;
       private boolean		inCDataSection;
   
       private Doctype		doctype;
   
       // parser modes
  -    private boolean		disableNamespaces = true;
  +    private boolean		disableNamespaces = true; /* Keep this for
  +                                                             backward API
  +                                                             compatibility,
  +                                                             but it does
  +                                                             not change any
  +                                                             behavior. */
       private boolean             ignoreWhitespace = false;
       private boolean             expandEntityRefs = true;
       private boolean             ignoreComments = false;
  @@ -450,7 +455,7 @@
        * Receive notification of the beginning of an element.
        */
       public void startElement(String namespaceURI, String localName,
  -                             String rawName, Attributes attributes)
  +                             String qName, Attributes attributes)
   	throws SAXException
       {
   	//
  @@ -460,7 +465,7 @@
   	int length = attributes.getLength();
   	if (length != 0) {
   	    try {
  -		attSet = new AttributeSet(attributes);
  +                attSet = AttributeSet.createAttributeSet1(attributes);
   	    } catch (DOMException ex) {
   		throw new SAXParseException(getMessage("XDB-002",
                           new Object[] { ex.getMessage() }), locator, ex);
  @@ -471,22 +476,9 @@
   	// Then create the element, associate its attributes, and
   	// stack it for later addition.
   	//
  -        ElementNode2 e = null;
  +        ElementNode e = null;
   	try {
  -            if ("".equals(namespaceURI)) {
  -                // No namespaceURI
  -                if (disableNamespaces) {
  -                    // Enable element factory backward compatibility using
  -                    // DOM Level 1 methods
  -                    e = (ElementNode2)document.createElementEx(rawName);
  -                } else {
  -                    // Use DOM Level 2 method
  -                    e = (ElementNode2)document.createElementNS(null, rawName);
  -                }
  -            } else {
  -                e = (ElementNode2)document.createElementNS(namespaceURI,
  -                                                           rawName);
  -            }
  +            e = (ElementNode) document.createElementEx(qName);
   	} catch (DOMException ex) {
   	    throw new SAXParseException(getMessage("XDB-004",
                       new Object[] { ex.getMessage() }), locator, ex);
  @@ -501,22 +493,13 @@
   
   	elementStack[topOfStack++].appendChild(e);
   	elementStack[topOfStack] = e;
  -
  -	//
  -	// Division of responsibility for namespace processing is (being
  -	// revised so) that the DOM builder reports errors when namespace
  -	// constraints are violated, and the parser is ignorant of them.
  -	//
  -	if (!disableNamespaces) {
  -            // XXX check duplicate attributes here ???
  -	}
       }
   
       /**
        * Receive notification of the end of an element.
        */
       public void endElement(String namespaceURI, String localName,
  -                           String rawName)
  +                           String qName)
   	throws SAXException
       {
           ParentNode e = (ParentNode) elementStack[topOfStack];
  @@ -611,10 +594,6 @@
       public void processingInstruction(String name, String instruction) 
           throws SAXException
       {
  -	if (!disableNamespaces && name.indexOf (':') != -1) {
  -	    throw new SAXParseException((getMessage ("XDB-010")), locator);
  -        }
  -
   	// Ignore PIs in DTD for DOM support
   	if (inDTD)
   	    return;
  @@ -788,10 +767,6 @@
       public void internalEntityDecl(String name, String value)
   	throws SAXException
       {
  -        if (!disableNamespaces && name.indexOf (':') != -1) {
  -            throw new SAXParseException((getMessage("XDB-012")), locator);
  -        }
  -
           // SAX2 reports PEDecls which we ignore for DOM2.  SAX2 also reports
           // only the first defined GEDecl which matches with DOM2.
           if (!name.startsWith("%")) {
  @@ -806,10 +781,6 @@
                                      String systemId)
   	throws SAXException
       {
  -        if (!disableNamespaces && name.indexOf (':') != -1) {
  -            throw new SAXParseException((getMessage("XDB-012")), locator);
  -        }
  -
           // SAX2 reports PEDecls which we ignore for DOM2.  SAX2 also reports
           // only the first defined GEDecl which matches with DOM2.
           if (!name.startsWith("%")) {
  @@ -828,10 +799,6 @@
       public void notationDecl(String n, String p, String s)
   	throws SAXException
       {
  -        if (!disableNamespaces && n.indexOf(':') != -1) {
  -            throw new SAXParseException((getMessage("XDB-013")), locator);
  -        }
  -
           doctype.addNotation(n, p, s);
       }
   
  @@ -842,10 +809,6 @@
                                      String systemId, String notation)
   	throws SAXException
       {
  -        if (!disableNamespaces && name.indexOf(':') != -1) {
  -            throw new SAXParseException((getMessage("XDB-012")), locator);
  -        }
  -
           doctype.addEntityNode(name, publicId, systemId, notation);
       }
   }
  
  
  
  1.4       +4 -4      xml-crimson/src/org/apache/crimson/tree/ElementNode2.java
  
  Index: ElementNode2.java
  ===================================================================
  RCS file: /home/cvs/xml-crimson/src/org/apache/crimson/tree/ElementNode2.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ElementNode2.java	2001/03/06 20:46:28	1.3
  +++ ElementNode2.java	2001/03/09 01:04:26	1.4
  @@ -1,5 +1,5 @@
   /*
  - * $Id: ElementNode2.java,v 1.3 2001/03/06 20:46:28 edwingo Exp $
  + * $Id: ElementNode2.java,v 1.4 2001/03/09 01:04:26 edwingo Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -165,9 +165,9 @@
           }
   
           // If we get here then we must have a valid prefix
  -        if (namespaceURI == null || namespaceURI.equals("")
  -                || (prefix.equals("xml") &&
  -                    !XmlNames.SPEC_XML_URI.equals(namespaceURI))) {
  +        if (namespaceURI == null
  +            || (prefix.equals("xml") &&
  +                !XmlNames.SPEC_XML_URI.equals(namespaceURI))) {
               throw new DomEx(DomEx.NAMESPACE_ERR);
           }
       }
  
  
  
  1.10      +48 -7     xml-crimson/src/org/apache/crimson/tree/AttributeSet.java
  
  Index: AttributeSet.java
  ===================================================================
  RCS file: /home/cvs/xml-crimson/src/org/apache/crimson/tree/AttributeSet.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AttributeSet.java	2001/02/24 03:23:48	1.9
  +++ AttributeSet.java	2001/03/09 01:04:26	1.10
  @@ -1,5 +1,5 @@
   /*
  - * $Id: AttributeSet.java,v 1.9 2001/02/24 03:23:48 edwingo Exp $
  + * $Id: AttributeSet.java,v 1.10 2001/03/09 01:04:26 edwingo Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -80,7 +80,7 @@
    * document or was instead defaulted by attribute processing.
    *
    * @author David Brownell
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   final
   class AttributeSet implements NamedNodeMap, XmlWritable
  @@ -89,6 +89,10 @@
       private Vector      list;
       private Element     ownerElement;
           
  +    private AttributeSet() {
  +        // no-arg constructor
  +    }
  +
       /* Constructs an attribute list, with associated name scope. */
       // package private
       AttributeSet(Element ownerElement) {
  @@ -121,13 +125,18 @@
       }
   
       /**
  -     * <b>DOM2:</b> Create DOM NamedNodeMap from SAX2 Attributes object
  +     * Create a DOM NamedNodeMap consisting of DOM Level 2 Attr nodes from
  +     * a SAX2 Attributes object
        */
  -    AttributeSet(Attributes source) throws DOMException {
  +    static AttributeSet createAttributeSet2(Attributes source)
  +        throws DOMException
  +    {
  +        AttributeSet retval = new AttributeSet();
  +
           int len = source.getLength();
           AttributesEx ex = null;
   
  -        list = new Vector(len);
  +        retval.list = new Vector(len);
           if (source instanceof AttributesEx) {
               ex = (AttributesEx) source;
           }
  @@ -159,9 +168,41 @@
                                     ex == null    // remember any default value
                                     ? null
                                     : ex.getDefault(i));
  -            list.addElement(attrNode);
  +            retval.list.addElement(attrNode);
           }
  -        list.trimToSize();
  +        return retval;
  +    }
  +
  +    /**
  +     * Create a DOM NamedNodeMap consisting of DOM Level 1 Attr nodes from
  +     * a SAX2 Attributes object
  +     */
  +    static AttributeSet createAttributeSet1(Attributes source)
  +        throws DOMException
  +    {
  +        AttributeSet retval = new AttributeSet();
  +
  +        int len = source.getLength();
  +        AttributesEx ex = null;
  +
  +        retval.list = new Vector(len);
  +        if (source instanceof AttributesEx) {
  +            ex = (AttributesEx) source;
  +        }
  +
  +	for (int i = 0; i < len; i++) {
  +            AttributeNode1 attrNode1 = new AttributeNode1(
  +                source.getQName(i),
  +                source.getValue(i),
  +                ex == null	// remember if it was specified
  +                    ? true
  +                    : ex.isSpecified(i),
  +                ex == null	// remember any default value
  +                    ? null
  +                    : ex.getDefault(i));
  +	    retval.list.addElement(attrNode1);
  +	}
  +        return retval;
       }
   
       // package private
  
  
  
  1.1                  xml-crimson/src/org/apache/crimson/tree/XmlDocumentBuilder2.java
  
  Index: XmlDocumentBuilder2.java
  ===================================================================
  /* 
   * $Id: XmlDocumentBuilder2.java,v 1.1 2001/03/09 01:04:26 edwingo Exp $
   *
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Crimson" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, Sun Microsystems, Inc., 
   * http://www.sun.com.  For more information on the Apache Software 
   * Foundation, please see <http://www.apache.org/>.
   */
  
  package org.apache.crimson.tree;
  
  import org.xml.sax.SAXException;
  import org.xml.sax.SAXParseException;
  import org.xml.sax.Attributes;
  
  import org.w3c.dom.DOMException;
  
  import org.apache.crimson.parser.AttributesEx;
  
  /**
   * This class implements a DOM tree builder which uses DOM Level 2 create
   * methods and assumes disableNamespaces is false, ie. namespaceAware is
   * true.
   */
  public class XmlDocumentBuilder2 extends XmlDocumentBuilder
  {
      /**
       * Receive notification of the beginning of an element.
       */
      public void startElement(String namespaceURI, String localName,
                               String qName, Attributes attributes)
  	throws SAXException
      {
  	//
  	// Convert set of attributes to DOM representation.
  	//
          AttributeSet attSet = null;
  	int length = attributes.getLength();
  	if (length != 0) {
  	    try {
                  attSet = AttributeSet.createAttributeSet2(attributes);
  	    } catch (DOMException ex) {
  		throw new SAXParseException(getMessage("XDB-002",
                          new Object[] { ex.getMessage() }), locator, ex);
  	    }
  	}
  
  	//
  	// Then create the element, associate its attributes, and
  	// stack it for later addition.
  	//
          ElementNode2 e = null;
  	try {
              e = (ElementNode2)document.createElementNS(namespaceURI, qName);
  	} catch (DOMException ex) {
  	    throw new SAXParseException(getMessage("XDB-004",
                      new Object[] { ex.getMessage() }), locator, ex);
  	}
  	if (attributes instanceof AttributesEx) {
  	    e.setIdAttributeName(
  		((AttributesEx)attributes).getIdAttributeName());
          }
  	if (length != 0) {
  	    e.setAttributes(attSet);
          }
  
  	elementStack[topOfStack++].appendChild(e);
  	elementStack[topOfStack] = e;
  
  	//
  	// Division of responsibility for namespace processing is (being
  	// revised so) that the DOM builder reports errors when namespace
  	// constraints are violated, and the parser is ignorant of them.
  	//
          // XXX check duplicate attributes here ???
      }
  
      /**
       * Receive notification of a processing instruction.
       */
      public void processingInstruction(String name, String instruction) 
          throws SAXException
      {
  	if (name.indexOf (':') != -1) {
  	    throw new SAXParseException((getMessage ("XDB-010")), locator);
          }
          super.processingInstruction(name, instruction);
      }
  
      /**
       * Report an internal entity declaration.
       */
      public void internalEntityDecl(String name, String value)
  	throws SAXException
      {
          if (name.indexOf (':') != -1) {
              throw new SAXParseException((getMessage("XDB-012")), locator);
          }
          super.internalEntityDecl(name, value);
      }
  
      /**
       * Report a parsed external entity declaration.
       */
      public void externalEntityDecl(String name, String publicId,
                                     String systemId)
  	throws SAXException
      {
          if (name.indexOf (':') != -1) {
              throw new SAXParseException((getMessage("XDB-012")), locator);
          }
          super.externalEntityDecl(name, publicId, systemId);
      }
  
      //////////////////////////////////////////////////////////////////////
      // org.xml.sax.DTDHandler callbacks
      //////////////////////////////////////////////////////////////////////
  
      /**
       * Receive notification of a notation declaration event.
       */
      public void notationDecl(String n, String p, String s)
  	throws SAXException
      {
          if (n.indexOf(':') != -1) {
              throw new SAXParseException((getMessage("XDB-013")), locator);
          }
          super.notationDecl(n, p, s);
      }
  
      /**
       * Receive notification of an unparsed entity declaration event.
       */
      public void unparsedEntityDecl(String name, String publicId, 
                                     String systemId, String notation)
  	throws SAXException
      {
          if (name.indexOf(':') != -1) {
              throw new SAXParseException((getMessage("XDB-012")), locator);
          }
          super.unparsedEntityDecl(name, publicId, systemId, notation);
      }
  }
  
  
  
  1.2       +2 -2      xml-crimson/src/org/apache/crimson/parser/resources/Messages.properties
  
  Index: Messages.properties
  ===================================================================
  RCS file: /home/cvs/xml-crimson/src/org/apache/crimson/parser/resources/Messages.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Messages.properties	2001/02/15 22:47:16	1.1
  +++ Messages.properties	2001/03/09 01:04:27	1.2
  @@ -1,5 +1,5 @@
   #
  -# $Id: Messages.properties,v 1.1 2001/02/15 22:47:16 edwingo Exp $
  +# $Id: Messages.properties,v 1.2 2001/03/09 01:04:27 edwingo Exp $
   #
   #
   
  @@ -163,7 +163,7 @@
   P-081 = Incomplete Unicode surrogate pair:  &#x{0}.
   P-082 = External entity not found: "{0}".
   P-083 = Illegal Namespace prefix: "{0}".
  -P-084 = Undeclared prefix: "{0}".
  +P-084 = Undeclared prefix in name: "{0}".
   
   #
   # Validation messages, won't normally show up unless validation is
  
  
  
  1.5       +9 -2      xml-crimson/src/org/apache/crimson/parser/Parser2.java
  
  Index: Parser2.java
  ===================================================================
  RCS file: /home/cvs/xml-crimson/src/org/apache/crimson/parser/Parser2.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Parser2.java	2001/01/23 23:41:47	1.4
  +++ Parser2.java	2001/03/09 01:04:28	1.5
  @@ -1,5 +1,5 @@
   /*
  - * $Id: Parser2.java,v 1.4 2001/01/23 23:41:47 edwingo Exp $
  + * $Id: Parser2.java,v 1.5 2001/03/09 01:04:28 edwingo Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -72,6 +72,7 @@
   
   import org.apache.crimson.util.MessageCatalog;
   import org.apache.crimson.util.XmlChars;
  +import org.apache.crimson.util.XmlNames;
   
   
   //
  @@ -118,7 +119,7 @@
    * @author David Brownell
    * @author Rajiv Mordani
    * @author Edwin Goei
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class Parser2
   {
  @@ -1446,6 +1447,9 @@
           // OK, finally report the event.
           if (namespaces) {
               String[] parts = processName(name.name, false);
  +            System.out.println("name.name= " + name.name);
  +            System.out.println("parts: " + parts[0] + " "
  +                               + parts[1] + " " + parts[2]);
               contentHandler.startElement(parts[0], parts[1], parts[2], attTmp);
           } else {
               contentHandler.startElement("", "", name.name, attTmp);
  @@ -1577,6 +1581,9 @@
                                                  isAttribute);
           if (parts == null) {
               parts = new String[3];
  +            parts[0] = "";
  +            String localName = XmlNames.getLocalPart(qName);
  +            parts[1] = localName != null ? localName.intern() : "";
               parts[2] = qName.intern();
               error("P-084", new Object[] { qName });
           }
  
  
  
  1.4       +22 -11    xml-crimson/src/org/apache/crimson/jaxp/DocumentBuilderImpl.java
  
  Index: DocumentBuilderImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-crimson/src/org/apache/crimson/jaxp/DocumentBuilderImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DocumentBuilderImpl.java	2001/02/07 00:07:40	1.3
  +++ DocumentBuilderImpl.java	2001/03/09 01:04:28	1.4
  @@ -1,5 +1,5 @@
   /*
  - * $Id: DocumentBuilderImpl.java,v 1.3 2001/02/07 00:07:40 edwingo Exp $
  + * $Id: DocumentBuilderImpl.java,v 1.4 2001/03/09 01:04:28 edwingo Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -71,6 +71,7 @@
   
   import org.apache.crimson.tree.XmlDocument;
   import org.apache.crimson.tree.XmlDocumentBuilder;
  +import org.apache.crimson.tree.XmlDocumentBuilder2;
   import org.apache.crimson.tree.DOMImplementationImpl;
   
   import org.xml.sax.XMLReader;
  @@ -83,7 +84,7 @@
   
   /**
    * @author Rajiv Mordani
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class DocumentBuilderImpl extends DocumentBuilder {
   
  @@ -101,6 +102,7 @@
           throws ParserConfigurationException
       {
           this.dbf = dbf;
  +        namespaceAware = dbf.isNamespaceAware();
   
           xmlReader = new XMLReaderImpl();
   
  @@ -117,15 +119,26 @@
                   setErrorHandler(new DefaultValidationErrorHandler());
               }
   
  -            // Namespace related features needed for XmlDocumentBuilder
  -            String namespaces = "http://xml.org/sax/features/namespaces";
  -            xmlReader.setFeature(namespaces, true);
  +            // SAX2 namespace-prefixes should be true for either builder
               String nsPrefixes =
                       "http://xml.org/sax/features/namespace-prefixes";
               xmlReader.setFeature(nsPrefixes, true);
  +
  +            if (namespaceAware) {
  +                // Namespace requirements for DOM Level 2 XmlDocumentBuilder
  +                String namespaces = "http://xml.org/sax/features/namespaces";
  +                xmlReader.setFeature(namespaces, true);
  +
  +                // Create XmlDocumentBuilder instance
  +                builder = new XmlDocumentBuilder2();
  +            } else {
  +                // Namespace requirements for DOM Level 1 XmlDocumentBuilder
  +                String namespaces = "http://xml.org/sax/features/namespaces";
  +                xmlReader.setFeature(namespaces, false);
   
  -            // Create XmlDocumentBuilder instance
  -            builder = new XmlDocumentBuilder();
  +                // Create XmlDocumentBuilder instance
  +                builder = new XmlDocumentBuilder();
  +            }
   
               // Use builder as the ContentHandler
               xmlReader.setContentHandler(builder);
  @@ -135,8 +148,8 @@
               xmlReader.setProperty(lexHandler, builder);
   
               // org.xml.sax.ext.DeclHandler
  -            String declHandler
  -                = "http://xml.org/sax/properties/declaration-handler";
  +            String declHandler =
  +                    "http://xml.org/sax/properties/declaration-handler";
               xmlReader.setProperty(declHandler, builder);
   
               // DTDHandler
  @@ -147,8 +160,6 @@
           }
   
           // Set various builder properties obtained from DocumentBuilderFactory
  -        namespaceAware = dbf.isNamespaceAware();
  -        builder.setDisableNamespaces(!namespaceAware);  
           builder.setIgnoreWhitespace(dbf.isIgnoringElementContentWhitespace());
           builder.setExpandEntityReferences(dbf.isExpandEntityReferences());
           builder.setIgnoreComments(dbf.isIgnoringComments());
  
  
  

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