--- old/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/TreeWalker.java 2017-06-14 09:46:20.778486926 -0700 +++ new/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/TreeWalker.java 2017-06-14 09:46:19.822439168 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -17,13 +17,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.sun.org.apache.xml.internal.serializer; -import com.sun.org.apache.xalan.internal.utils.SecuritySupport; -import java.io.File; +package com.sun.org.apache.xml.internal.serializer; -import com.sun.org.apache.xml.internal.serializer.utils.AttList; -import com.sun.org.apache.xml.internal.serializer.utils.DOM2Helper; +import com.sun.org.apache.xml.internal.utils.AttList; +import com.sun.org.apache.xml.internal.utils.DOM2Helper; +import javax.xml.transform.Result; import org.w3c.dom.Comment; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; @@ -31,7 +30,6 @@ import org.w3c.dom.Node; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; - import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.ext.LexicalHandler; @@ -58,12 +56,6 @@ */ final private SerializationHandler m_Serializer; - // ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON! - // DOM2Helper m_dh = new DOM2Helper(); - - /** DomHelper for this TreeWalker */ - final protected DOM2Helper m_dh; - /** Locator object for this TreeWalker */ final private LocatorImpl m_locator = new LocatorImpl(); @@ -78,7 +70,7 @@ } public TreeWalker(ContentHandler ch) { - this(ch,null); + this(ch, null); } /** * Constructor. @@ -99,8 +91,6 @@ if (systemId != null) { m_locator.setSystemId(systemId); } - - m_dh = new DOM2Helper(); } /** @@ -209,7 +199,7 @@ this.m_contentHandler.endDocument(); } - /** Flag indicating whether following text to be processed is raw text */ + // Flag indicating whether following text to be processed is raw text boolean nextIsRaw = false; /** @@ -313,7 +303,6 @@ final int colon = attrName.indexOf(':'); final String prefix; - // System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue()); if (attrName.equals("xmlns") || attrName.startsWith("xmlns:")) { // Use "" instead of null, as Xerces likes "" for the @@ -335,13 +324,13 @@ } } - String ns = m_dh.getNamespaceOfNode(node); + String ns = DOM2Helper.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.startElement(ns, - m_dh.getLocalNameOfNode(node), + DOM2Helper.getLocalNameOfNode(node), node.getNodeName(), - new AttList(atts, m_dh)); + new AttList(atts)); break; case Node.PROCESSING_INSTRUCTION_NODE : { @@ -389,9 +378,9 @@ { nextIsRaw = false; - m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); + m_contentHandler.processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); - m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); + m_contentHandler.processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { @@ -436,12 +425,12 @@ break; case Node.ELEMENT_NODE : - String ns = m_dh.getNamespaceOfNode(node); + String ns = DOM2Helper.getNamespaceOfNode(node); if(null == ns) ns = ""; this.m_contentHandler.endElement(ns, - m_dh.getLocalNameOfNode(node), - node.getNodeName()); + DOM2Helper.getLocalNameOfNode(node), + node.getNodeName()); if (m_Serializer == null) { // Don't bother with endPrefixMapping calls if the ContentHandler is a