# HG changeset patch # User joehw # Date 1497474722 25200 # Node ID dc68478b53b910d4d8f85a7bfae01e1fd6829680 # Parent 67a7eb6930747567b23a6f77e4a74d1d446692ff 8181153: Fix lint warnings in JAXP repo: dep-ann Reviewed-by: lancea diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -262,6 +261,7 @@ * @deprecated use getFirstCommonSuperclass(ReferenceType t) which has * slightly changed semantics. */ + @Deprecated public ReferenceType firstCommonSuperclass(ReferenceType t) { if (this.equals(Type.NULL)) return t; if (t.equals(Type.NULL)) return this; diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/lib/ExsltSets.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/lib/ExsltSets.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/lib/ExsltSets.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,7 +22,7 @@ */ package com.sun.org.apache.xalan.internal.lib; -import com.sun.org.apache.xml.internal.utils.DOMHelper; +import com.sun.org.apache.xml.internal.utils.DOM2Helper; import com.sun.org.apache.xpath.internal.NodeSet; import java.util.HashMap; import java.util.Map; @@ -72,8 +72,8 @@ for (int i = 0; i < nl1.getLength(); i++) { Node testNode = nl1.item(i); - if (DOMHelper.isNodeAfter(testNode, endNode) - && !DOMHelper.isNodeTheSame(testNode, endNode)) + if (DOM2Helper.isNodeAfter(testNode, endNode) + && !DOM2Helper.isNodeTheSame(testNode, endNode)) leadNodes.addElement(testNode); } return leadNodes; @@ -107,8 +107,8 @@ for (int i = 0; i < nl1.getLength(); i++) { Node testNode = nl1.item(i); - if (DOMHelper.isNodeAfter(startNode, testNode) - && !DOMHelper.isNodeTheSame(startNode, testNode)) + if (DOM2Helper.isNodeAfter(startNode, testNode) + && !DOM2Helper.isNodeTheSame(startNode, testNode)) trailNodes.addElement(testNode); } return trailNodes; diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -1426,24 +1422,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - } diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -1426,24 +1422,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - - } +} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -1425,25 +1421,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - } diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -1425,25 +1421,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - - } +} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -1425,25 +1421,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - - } +} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -1425,25 +1421,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - - } +} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -1015,7 +1011,7 @@ "\uC2DC\uC2A4\uD15C \uC18D\uC131 org.xml.sax.parser\uAC00 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4."}, { ER_PARSER_ARG_CANNOT_BE_NULL, - "\uAD6C\uBB38\uBD84\uC11D\uAE30 \uC778\uC218\uB294 \uB110\uC774 \uC544\uB2C8\uC5B4\uC57C \uD569\uB2C8\uB2E4."}, + "\uAD6C\uBB38 \uBD84\uC11D\uAE30 \uC778\uC218\uB294 \uB110\uC774 \uC544\uB2C8\uC5B4\uC57C \uD569\uB2C8\uB2E4."}, { ER_FEATURE, "\uAE30\uB2A5: {0}"}, @@ -1252,7 +1248,7 @@ "\uD2B9\uC218 \uCDA9\uB3CC\uC774 \uBC1C\uACAC\uB428: {0}. \uC2A4\uD0C0\uC77C\uC2DC\uD2B8\uC5D0\uC11C \uBC1C\uACAC\uB41C \uB9C8\uC9C0\uB9C9 \uD56D\uBAA9\uC774 \uC0AC\uC6A9\uB429\uB2C8\uB2E4."}, { WG_PARSING_AND_PREPARING, - "========= \uAD6C\uBB38\uBD84\uC11D \uD6C4 {0} \uC900\uBE44 \uC911 =========="}, + "========= \uAD6C\uBB38 \uBD84\uC11D \uD6C4 {0} \uC900\uBE44 \uC911 =========="}, { WG_ATTR_TEMPLATE, "\uC18D\uC131 \uD15C\uD50C\uB9AC\uD2B8, {0}"}, @@ -1357,7 +1353,7 @@ { "optionOUT", " [-OUT outputFileName]"}, { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"}, { "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"}, - { "optionPARSER", " [-PARSER \uAD6C\uBB38\uBD84\uC11D\uAE30 \uC5F0\uACB0\uC758 \uC804\uCCB4 \uD074\uB798\uC2A4 \uC774\uB984]"}, + { "optionPARSER", " [-PARSER \uAD6C\uBB38 \uBD84\uC11D\uAE30 \uC5F0\uACB0\uC758 \uC804\uCCB4 \uD074\uB798\uC2A4 \uC774\uB984]"}, { "optionE", " [-E(\uC5D4\uD2F0\uD2F0 \uCC38\uC870 \uD655\uC7A5 \uC548\uD568)]"}, { "optionV", " [-E(\uC5D4\uD2F0\uD2F0 \uCC38\uC870 \uD655\uC7A5 \uC548\uD568)]"}, { "optionQC", " [-QC(\uC790\uB3D9 \uD328\uD134 \uCDA9\uB3CC \uACBD\uACE0)]"}, @@ -1378,9 +1374,9 @@ { "optionHTML", " [-HTML(HTML \uD3EC\uB9F7\uD130 \uC0AC\uC6A9)]"}, { "optionPARAM", " [-PARAM \uC774\uB984 \uD45C\uD604\uC2DD(\uC2A4\uD0C0\uC77C\uC2DC\uD2B8 \uB9E4\uAC1C\uBCC0\uC218 \uC124\uC815)]"}, { "noParsermsg1", "XSL \uD504\uB85C\uC138\uC2A4\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4."}, - { "noParsermsg2", "** \uAD6C\uBB38\uBD84\uC11D\uAE30\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C **"}, + { "noParsermsg2", "** \uAD6C\uBB38 \uBD84\uC11D\uAE30\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C **"}, { "noParsermsg3", "\uD074\uB798\uC2A4 \uACBD\uB85C\uB97C \uD655\uC778\uD558\uC2ED\uC2DC\uC624."}, - { "noParsermsg4", "IBM\uC758 Java\uC6A9 XML \uAD6C\uBB38\uBD84\uC11D\uAE30\uAC00 \uC5C6\uC744 \uACBD\uC6B0 \uB2E4\uC74C \uC704\uCE58\uC5D0\uC11C \uB2E4\uC6B4\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."}, + { "noParsermsg4", "IBM\uC758 Java\uC6A9 XML \uAD6C\uBB38 \uBD84\uC11D\uAE30\uAC00 \uC5C6\uC744 \uACBD\uC6B0 \uB2E4\uC74C \uC704\uCE58\uC5D0\uC11C \uB2E4\uC6B4\uB85C\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."}, { "noParsermsg5", "IBM AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"}, { "optionURIRESOLVER", " [-URIRESOLVER \uC804\uCCB4 \uD074\uB798\uC2A4 \uC774\uB984(URI \uBD84\uC11D\uC5D0 \uC0AC\uC6A9\uD560 URIResolver)]"}, { "optionENTITYRESOLVER", " [-ENTITYRESOLVER \uC804\uCCB4 \uD074\uB798\uC2A4 \uC774\uB984(\uC5D4\uD2F0\uD2F0 \uBD84\uC11D\uC5D0 \uC0AC\uC6A9\uD560 EntityResolver)]"}, @@ -1425,25 +1421,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - - } +} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -1425,25 +1421,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - - } +} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -482,7 +478,7 @@ {"ER0000" , "{0}" }, { ER_NO_CURLYBRACE, - "Fel: Uttryck f\u00E5r inte inneh\u00E5lla '{'"}, + "Fel: Uttryck kan inte inneh\u00E5lla '{'"}, { ER_ILLEGAL_ATTRIBUTE , "{0} har ett otill\u00E5tet attribut: {1}"}, @@ -1426,24 +1422,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - - } +} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -1425,25 +1421,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - - } +} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -22,9 +21,6 @@ package com.sun.org.apache.xalan.internal.res; import java.util.ListResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; /** * Set up error messages. @@ -1425,25 +1421,4 @@ /** String for use when formatting of the error string failed. */ public static final String FORMAT_FAILED = "FORMAT_FAILED"; - - /** General error string. */ - public static final String ERROR_STRING = "#error"; - - /** String to prepend to error messages. */ - public static final String ERROR_HEADER = "Error: "; - - /** String to prepend to warning messages. */ - public static final String WARNING_HEADER = "Warning: "; - - /** String to specify the XSLT module. */ - public static final String XSL_HEADER = "XSLT "; - - /** String to specify the XML parser module. */ - public static final String XML_HEADER = "XML "; - - /** I don't think this is used any more. - * @deprecated */ - public static final String QUERY_HEADER = "PATTERN "; - - - } +} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/ForwardPositionIterator.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/ForwardPositionIterator.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/ForwardPositionIterator.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -60,6 +59,7 @@ * @deprecated This class exists only for backwards compatibility with old * translets. New code should not reference it. */ +@Deprecated public final class ForwardPositionIterator extends DTMAxisIteratorBase { private DTMAxisIterator _source; diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -115,6 +115,7 @@ * Merge the current value's nodeset set by lookupKey() with _nodes. * @deprecated */ + @Deprecated public void merge(KeyIndex other) { if (other == null) return; @@ -136,6 +137,7 @@ * key() function. * @deprecated */ + @Deprecated public void lookupId(Object value) { // Clear _nodes array _nodes = null; @@ -205,6 +207,7 @@ * deprecated.
* @deprecated */ + @Deprecated public void lookupKey(Object value) { IntegerArray nodes = _index.get(value); _nodes = (nodes != null) ? (IntegerArray) nodes.clone() : null; @@ -217,6 +220,7 @@ * deprecated. * @deprecated */ + @Deprecated public int next() { if (_nodes == null) return DTMAxisIterator.END; @@ -313,6 +317,7 @@ * deprecated. * @deprecated */ + @Deprecated public DTMAxisIterator reset() { _position = 0; return this; @@ -324,6 +329,7 @@ * deprecated. * @deprecated */ + @Deprecated public int getLast() { return (_nodes == null) ? 0 : _nodes.cardinality(); } @@ -334,6 +340,7 @@ * deprecated. * @deprecated */ + @Deprecated public int getPosition() { return _position; } @@ -344,6 +351,7 @@ * deprecated. * @deprecated */ + @Deprecated public void setMark() { _markedPosition = _position; } @@ -354,6 +362,7 @@ * deprecated. * @deprecated */ + @Deprecated public void gotoMark() { _position = _markedPosition; } @@ -365,6 +374,7 @@ * deprecated. * @deprecated */ + @Deprecated public DTMAxisIterator setStartNode(int start) { if (start == DTMAxisIterator.END) { _nodes = null; @@ -382,6 +392,7 @@ * deprecated. * @deprecated */ + @Deprecated public int getStartNode() { return 0; } @@ -392,6 +403,7 @@ * deprecated. * @deprecated */ + @Deprecated public boolean isReverse() { return(false); } @@ -402,6 +414,7 @@ * deprecated. * @deprecated */ + @Deprecated public DTMAxisIterator cloneIterator() { KeyIndex other = new KeyIndex(0); other._index = _index; diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecord.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -49,6 +48,7 @@ * @deprecated This field continues to exist for binary compatibility. * New code should not refer to it. */ + @Deprecated private static final Collator DEFAULT_COLLATOR = Collator.getInstance(); /** @@ -56,6 +56,7 @@ * @deprecated This field continues to exist for binary compatibility. * New code should not refer to it. */ + @Deprecated protected Collator _collator = DEFAULT_COLLATOR; protected Collator[] _collators; @@ -64,6 +65,7 @@ * @deprecated This field continues to exist for binary compatibility. * New code should not refer to it. */ + @Deprecated protected Locale _locale; protected CollatorFactory _collatorFactory; diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/NodeSortRecordFactory.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -55,6 +54,7 @@ * @deprecated This constructor is no longer used in generated code. It * exists only for backwards compatibility. */ + @Deprecated public NodeSortRecordFactory(DOM dom, String className, Translet translet, String order[], String type[]) throws TransletException diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -100,6 +100,7 @@ * @deprecated This method exists only for backwards compatibility with old * translets. New code should not reference it. */ + @Deprecated public static int positionF(DTMAxisIterator iterator) { return iterator.isReverse() ? iterator.getLast() - iterator.getPosition() + 1 diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/AttrImpl.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/AttrImpl.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/AttrImpl.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -516,6 +515,7 @@ * @deprecated Previous working draft of DOM Level 2. New method * is getOwnerElement(). */ + @Deprecated public Element getElement() { // if we have an owner, ownerNode is our ownerElement, otherwise it's // our ownerDocument and we don't have an ownerElement diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -832,6 +832,7 @@ * compatibility with older applications. New applications * should never call this method. */ + @Deprecated public void setEncoding(String value) { setXmlEncoding(value); } @@ -849,6 +850,7 @@ * compatibility with older applications. New applications * should never call this method. */ + @Deprecated public String getEncoding() { return getXmlEncoding(); } @@ -890,6 +892,7 @@ * compatibility with older applications. New applications * should never call this method. */ + @Deprecated public void setVersion(String value) { setXmlVersion(value); } @@ -908,6 +911,7 @@ * compatibility with older applications. New applications * should never call this method. */ + @Deprecated public String getVersion() { return getXmlVersion(); } @@ -932,6 +936,7 @@ * compatibility with older applications. New applications * should never call this method. */ + @Deprecated public void setStandalone(boolean value) { setXmlStandalone(value); } @@ -950,6 +955,7 @@ * compatibility with older applications. New applications * should never call this method. */ + @Deprecated public boolean getStandalone() { return getXmlStandalone(); } diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java Wed Jun 14 14:12:02 2017 -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 @@ -369,6 +369,7 @@ * Creates an element node with a URI in the table and type information. * @deprecated */ + @Deprecated public int createDeferredElement(String elementURI, String elementName, Object type) { @@ -389,6 +390,7 @@ * Creates an element node in the table. * @deprecated */ + @Deprecated public int createDeferredElement(String elementName) { return createDeferredElement(null, elementName); } @@ -474,6 +476,7 @@ * Sets an attribute on an element node. * @deprecated */ + @Deprecated public int setDeferredAttribute(int elementNodeIndex, String attrName, String attrURI, String attrValue, boolean specified) { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/NodeImpl.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/NodeImpl.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/NodeImpl.java Wed Jun 14 14:12:02 2017 -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 @@ -763,6 +763,7 @@ * @since DOM Level 3 * @deprecated */ + @Deprecated public short compareTreePosition(Node other) { // Questions of clarification for this method - to be answered by the // DOM WG. Current assumptions listed - LM diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/ItemPSVI.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/ItemPSVI.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/ItemPSVI.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -116,6 +115,7 @@ * * @deprecated Use getSchemaValue().getNormalizedValue() instead */ + @Deprecated public String getSchemaNormalizedValue(); /** @@ -127,6 +127,7 @@ * * @deprecated Use getSchemaValue().getActualValue() instead */ + @Deprecated public Object getActualNormalizedValue() throws XSException; @@ -146,6 +147,7 @@ * * @deprecated Use getSchemaValue().getActualValueType() instead */ + @Deprecated public short getActualNormalizedValueType() throws XSException; @@ -182,6 +184,7 @@ * * @deprecated Use getSchemaValue().getListValueTypes() instead */ + @Deprecated public ShortList getItemValueTypes() throws XSException; diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeDeclaration.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeDeclaration.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeDeclaration.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -55,6 +54,7 @@ * * @deprecated Use getValueConstraintValue().getNormalizedValue() instead */ + @Deprecated public String getConstraintValue(); /** @@ -67,6 +67,7 @@ * * @deprecated Use getValueConstraintValue().getActualValue() instead */ + @Deprecated public Object getActualVC() throws XSException; @@ -86,6 +87,7 @@ * * @deprecated Use getValueConstraintValue().getActualValueType() instead */ + @Deprecated public short getActualVCType() throws XSException; @@ -104,6 +106,7 @@ * * @deprecated Use getValueConstraintValue().getListValueTypes() instead */ + @Deprecated public ShortList getItemValueTypes() throws XSException; diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeUse.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeUse.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSAttributeUse.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -48,6 +47,7 @@ * * @deprecated Use getValueConstraintValue().getNormalizedValue() instead */ + @Deprecated public String getConstraintValue(); /** @@ -60,6 +60,7 @@ * * @deprecated Use getValueConstraintValue().getActualValue() instead */ + @Deprecated public Object getActualVC() throws XSException; @@ -79,6 +80,7 @@ * * @deprecated Use getValueConstraintValue().getActualValueType() instead */ + @Deprecated public short getActualVCType() throws XSException; @@ -97,6 +99,7 @@ * * @deprecated Use getValueConstraintValue().getListValueTypes() instead */ + @Deprecated public ShortList getItemValueTypes() throws XSException; diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSElementDeclaration.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSElementDeclaration.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xs/XSElementDeclaration.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -56,6 +55,7 @@ * * @deprecated Use getValueConstraintValue().getNormalizedValue() instead */ + @Deprecated public String getConstraintValue(); /** @@ -68,6 +68,7 @@ * * @deprecated Use getValueConstraintValue().getActualValue() instead */ + @Deprecated public Object getActualVC() throws XSException; @@ -87,6 +88,7 @@ * * @deprecated Use getValueConstraintValue().getActualValueType() instead */ + @Deprecated public short getActualVCType() throws XSException; @@ -105,6 +107,7 @@ * * @deprecated Use getValueConstraintValue().getListValueTypes() instead */ + @Deprecated public ShortList getItemValueTypes() throws XSException; diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/CoroutineParser.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/CoroutineParser.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/CoroutineParser.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -45,6 +44,7 @@ * coroutine protocol was not being used and was complicating design. * See {@link IncrementalSAXSource}. * */ +@Deprecated public interface CoroutineParser { /** @return the coroutine ID number for this CoroutineParser object. diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java Wed Jun 14 14:12:02 2017 -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 @@ -128,6 +128,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public abstract class BaseMarkupSerializer implements ContentHandler, DocumentHandler, LexicalHandler, DTDHandler, DeclHandler, DOMSerializer, Serializer diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializer.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializer.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializer.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -42,6 +41,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public interface DOMSerializer { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -76,6 +75,7 @@ * @deprecated As of JDK 9, Xerces 2.9.0, replaced by * {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl} */ +@Deprecated public class DOMSerializerImpl implements LSSerializer, DOMConfiguration { // TODO: When DOM Level 3 goes to REC replace method calls using diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/ElementState.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/ElementState.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/ElementState.java Wed Jun 14 14:12:02 2017 -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 @@ -36,6 +36,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class ElementState { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/EncodingInfo.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/EncodingInfo.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/EncodingInfo.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -37,6 +36,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class EncodingInfo { // name of encoding as registered with IANA; diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Encodings.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Encodings.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Encodings.java Wed Jun 14 14:12:02 2017 -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 @@ -42,6 +42,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated class Encodings { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLSerializer.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLSerializer.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLSerializer.java Wed Jun 14 14:12:02 2017 -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 @@ -92,6 +92,7 @@ * @author Assaf Arkin * @see Serializer */ +@Deprecated public class HTMLSerializer extends BaseMarkupSerializer { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java Wed Jun 14 14:12:02 2017 -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 @@ -51,6 +51,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public final class HTMLdtd { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/IndentPrinter.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/IndentPrinter.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/IndentPrinter.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -39,6 +38,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class IndentPrinter extends Printer { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/LineSeparator.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/LineSeparator.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/LineSeparator.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -32,6 +31,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public final class LineSeparator { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Method.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Method.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Method.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -32,6 +31,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public final class Method { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/OutputFormat.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/OutputFormat.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/OutputFormat.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -65,6 +64,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class OutputFormat { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Printer.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Printer.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Printer.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -47,6 +46,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class Printer { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Serializer.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Serializer.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/Serializer.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -67,6 +66,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public interface Serializer { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactory.java Wed Jun 14 14:12:02 2017 -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 @@ -42,6 +42,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public abstract class SerializerFactory { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactoryImpl.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactoryImpl.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SerializerFactoryImpl.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -41,6 +40,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated final class SerializerFactoryImpl extends SerializerFactory { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/TextSerializer.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/TextSerializer.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/TextSerializer.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -65,6 +64,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class TextSerializer extends BaseMarkupSerializer { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XHTMLSerializer.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XHTMLSerializer.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XHTMLSerializer.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -39,6 +38,7 @@ * @author Assaf Arkin * @see Serializer */ +@Deprecated public class XHTMLSerializer extends HTMLSerializer { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XML11Serializer.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XML11Serializer.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XML11Serializer.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -84,6 +83,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class XML11Serializer extends XMLSerializer { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XMLSerializer.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XMLSerializer.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XMLSerializer.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -95,6 +94,7 @@ * {@link com.sun.org.apache.xml.internal.serialize.DOMSerializerImpl} is replaced * by {@link com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl}. */ +@Deprecated public class XMLSerializer extends BaseMarkupSerializer { diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/TreeWalker.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/TreeWalker.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/TreeWalker.java Wed Jun 14 14:12:02 2017 -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; - -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 diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/AttList.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/AttList.java Wed Jun 14 20:02:36 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -/* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.serializer.utils; - -import org.w3c.dom.Attr; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -import org.xml.sax.Attributes; - -/** - * Wraps a DOM attribute list in a SAX Attributes. - * - * This class is a copy of the one in com.sun.org.apache.xml.internal.utils. - * It exists to cut the serializers dependancy on that package. - * A minor changes from that package are: - * DOMHelper reference changed to DOM2Helper, class is not "public" - * - * This class is not a public API, it is only public because it is - * used in com.sun.org.apache.xml.internal.serializer. - * - * @xsl.usage internal - */ -public final class AttList implements Attributes -{ - - /** List of attribute nodes */ - NamedNodeMap m_attrs; - - /** Index of last attribute node */ - int m_lastIndex; - - // ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON! - // DOM2Helper m_dh = new DOM2Helper(); - - /** Local reference to DOMHelper */ - DOM2Helper m_dh; - -// /** -// * Constructor AttList -// * -// * -// * @param attrs List of attributes this will contain -// */ -// public AttList(NamedNodeMap attrs) -// { -// -// m_attrs = attrs; -// m_lastIndex = m_attrs.getLength() - 1; -// m_dh = new DOM2Helper(); -// } - - /** - * Constructor AttList - * - * - * @param attrs List of attributes this will contain - * @param dh DOMHelper - */ - public AttList(NamedNodeMap attrs, DOM2Helper dh) - { - - m_attrs = attrs; - m_lastIndex = m_attrs.getLength() - 1; - m_dh = dh; - } - - /** - * Get the number of attribute nodes in the list - * - * - * @return number of attribute nodes - */ - public int getLength() - { - return m_attrs.getLength(); - } - - /** - * Look up an attribute's Namespace URI by index. - * - * @param index The attribute index (zero-based). - * @return The Namespace URI, or the empty string if none - * is available, or null if the index is out of - * range. - */ - public String getURI(int index) - { - String ns = m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index))); - if(null == ns) - ns = ""; - return ns; - } - - /** - * Look up an attribute's local name by index. - * - * @param index The attribute index (zero-based). - * @return The local name, or the empty string if Namespace - * processing is not being performed, or null - * if the index is out of range. - */ - public String getLocalName(int index) - { - return m_dh.getLocalNameOfNode(((Attr) m_attrs.item(index))); - } - - /** - * Look up an attribute's qualified name by index. - * - * - * @param i The attribute index (zero-based). - * - * @return The attribute's qualified name - */ - public String getQName(int i) - { - return ((Attr) m_attrs.item(i)).getName(); - } - - /** - * Get the attribute's node type by index - * - * - * @param i The attribute index (zero-based) - * - * @return the attribute's node type - */ - public String getType(int i) - { - return "CDATA"; // for the moment - } - - /** - * Get the attribute's node value by index - * - * - * @param i The attribute index (zero-based) - * - * @return the attribute's node value - */ - public String getValue(int i) - { - return ((Attr) m_attrs.item(i)).getValue(); - } - - /** - * Get the attribute's node type by name - * - * - * @param name Attribute name - * - * @return the attribute's node type - */ - public String getType(String name) - { - return "CDATA"; // for the moment - } - - /** - * Look up an attribute's type by Namespace name. - * - * @param uri The Namespace URI, or the empty String if the - * name has no Namespace URI. - * @param localName The local name of the attribute. - * @return The attribute type as a string, or null if the - * attribute is not in the list or if Namespace - * processing is not being performed. - */ - public String getType(String uri, String localName) - { - return "CDATA"; // for the moment - } - - /** - * Look up an attribute's value by name. - * - * - * @param name The attribute node's name - * - * @return The attribute node's value - */ - public String getValue(String name) - { - Attr attr = ((Attr) m_attrs.getNamedItem(name)); - return (null != attr) - ? attr.getValue() : null; - } - - /** - * Look up an attribute's value by Namespace name. - * - * @param uri The Namespace URI, or the empty String if the - * name has no Namespace URI. - * @param localName The local name of the attribute. - * @return The attribute value as a string, or null if the - * attribute is not in the list. - */ - public String getValue(String uri, String localName) - { - Node a=m_attrs.getNamedItemNS(uri,localName); - return (a==null) ? null : a.getNodeValue(); - } - - /** - * Look up the index of an attribute by Namespace name. - * - * @param uri The Namespace URI, or the empty string if - * the name has no Namespace URI. - * @param localPart The attribute's local name. - * @return The index of the attribute, or -1 if it does not - * appear in the list. - */ - public int getIndex(String uri, String localPart) - { - for(int i=m_attrs.getLength()-1;i>=0;--i) - { - Node a=m_attrs.item(i); - String u=a.getNamespaceURI(); - if( (u==null ? uri==null : u.equals(uri)) - && - a.getLocalName().equals(localPart) ) - return i; - } - return -1; - } - - /** - * Look up the index of an attribute by raw XML 1.0 name. - * - * @param qName The qualified (prefixed) name. - * @return The index of the attribute, or -1 if it does not - * appear in the list. - */ - public int getIndex(String qName) - { - for(int i=m_attrs.getLength()-1;i>=0;--i) - { - Node a=m_attrs.item(i); - if(a.getNodeName().equals(qName) ) - return i; - } - return -1; - } -} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/DOM2Helper.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/utils/DOM2Helper.java Wed Jun 14 20:02:36 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.sun.org.apache.xml.internal.serializer.utils; - -import java.io.IOException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; - -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import org.xml.sax.InputSource; - -/** - * This class provides a DOM level 2 "helper", which provides services currently - * not provided be the DOM standard. - * - * This class is a copy of the one in com.sun.org.apache.xml.internal.utils. - * It exists to cut the serializers dependancy on that package. - * - * The differences from the original class are: - * it doesn't extend DOMHelper, not depricated, - * dropped method isNodeAfter(Node node1, Node node2) - * dropped method parse(InputSource) - * dropped method supportSAX() - * dropped method setDocument(doc) - * dropped method checkNode(Node) - * dropped method getDocument() - * dropped method getElementByID(String id, Document doc) - * dropped method getParentOfNode(Node node) - * dropped field Document m_doc; - * made class non-public - * - * This class is not a public API, it is only public because it is - * used in com.sun.org.apache.xml.internal.serializer. - * - * @xsl.usage internal - */ -public final class DOM2Helper -{ - - /** - * Construct an instance. - */ - public DOM2Helper(){} - - /** - * Returns the local name of the given node, as defined by the - * XML Namespaces specification. This is prepared to handle documents - * built using DOM Level 1 methods by falling back upon explicitly - * parsing the node name. - * - * @param n Node to be examined - * - * @return String containing the local name, or null if the node - * was not assigned a Namespace. - */ - public String getLocalNameOfNode(Node n) - { - - String name = n.getLocalName(); - - return (null == name) ? getLocalNameOfNodeFallback(n) : name; - } - - /** - * Returns the local name of the given node. If the node's name begins - * with a namespace prefix, this is the part after the colon; otherwise - * it's the full node name. - * - * This method is copied from com.sun.org.apache.xml.internal.utils.DOMHelper - * - * @param n the node to be examined. - * - * @return String containing the Local Name - */ - private String getLocalNameOfNodeFallback(Node n) - { - - String qname = n.getNodeName(); - int index = qname.indexOf(':'); - - return (index < 0) ? qname : qname.substring(index + 1); - } - - /** - * Returns the Namespace Name (Namespace URI) for the given node. - * In a Level 2 DOM, you can ask the node itself. Note, however, that - * doing so conflicts with our decision in getLocalNameOfNode not - * to trust the that the DOM was indeed created using the Level 2 - * methods. If Level 1 methods were used, these two functions will - * disagree with each other. - *- * TODO: Reconcile with getLocalNameOfNode. - * - * @param n Node to be examined - * - * @return String containing the Namespace URI bound to this DOM node - * at the time the Node was created. - */ - public String getNamespaceOfNode(Node n) - { - return n.getNamespaceURI(); - } - - /** Field m_useDOM2getNamespaceURI is a compile-time flag which - * gates some of the parser options used to build a DOM -- but - * that code is commented out at this time and nobody else - * references it, so I've commented this out as well. */ - //private boolean m_useDOM2getNamespaceURI = false; -} diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/AttList.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/AttList.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/AttList.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -40,26 +39,9 @@ /** Index of last attribute node */ int m_lastIndex; - // ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON! + // JAXP Uses Xerces without setting the namespace processing to ON! // DOM2Helper m_dh = new DOM2Helper(); - /** Local reference to DOMHelper */ - DOMHelper m_dh; - -// /** -// * Constructor AttList -// * -// * -// * @param attrs List of attributes this will contain -// */ -// public AttList(NamedNodeMap attrs) -// { -// -// m_attrs = attrs; -// m_lastIndex = m_attrs.getLength() - 1; -// m_dh = new DOM2Helper(); -// } - /** * Constructor AttList * @@ -67,12 +49,10 @@ * @param attrs List of attributes this will contain * @param dh DOMHelper */ - public AttList(NamedNodeMap attrs, DOMHelper dh) + public AttList(NamedNodeMap attrs) { - m_attrs = attrs; m_lastIndex = m_attrs.getLength() - 1; - m_dh = dh; } /** @@ -96,7 +76,7 @@ */ public String getURI(int index) { - String ns = m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index))); + String ns = DOM2Helper.getNamespaceOfNode(((Attr) m_attrs.item(index))); if(null == ns) ns = ""; return ns; @@ -112,7 +92,7 @@ */ public String getLocalName(int index) { - return m_dh.getLocalNameOfNode(((Attr) m_attrs.item(index))); + return DOM2Helper.getLocalNameOfNode(((Attr) m_attrs.item(index))); } /** diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOM2Helper.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOM2Helper.java Wed Jun 14 20:02:36 2017 +0000 +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOM2Helper.java Wed Jun 14 14:12:02 2017 -0700 @@ -1,6 +1,5 @@ /* - * reserved comment block - * DO NOT REMOVE OR ALTER! + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -18,298 +17,327 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.sun.org.apache.xml.internal.utils; -import java.io.IOException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; - +import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy; import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; -import org.xml.sax.InputSource; /** - * @deprecated Since the introduction of the DTM, this class will be removed. - * This class provides a DOM level 2 "helper", which provides services currently - * not provided be the DOM standard. + * This class provides a DOM level 2 "helper", which provides several services. + * + * The original class extended DOMHelper that was deprecated and then removed. */ -public class DOM2Helper extends DOMHelper -{ - - /** - * Construct an instance. - */ - public DOM2Helper(){} +public final class DOM2Helper { - /** - * Check node to see if it was created by a DOM implementation - * that this helper is intended to support. This is currently - * disabled, and assumes all nodes are acceptable rather than checking - * that they implement com.sun.org.apache.xerces.internal.dom.NodeImpl. - * - * @param node The node to be tested. - * - * @throws TransformerException if the node is not one which this - * DOM2Helper can support. If we return without throwing the exception, - * the node is compatable. - * @xsl.usage internal - */ - public void checkNode(Node node) throws TransformerException - { - - // if(!(node instanceof com.sun.org.apache.xerces.internal.dom.NodeImpl)) - // throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_XERCES_CANNOT_HANDLE_NODES, new Object[]{((Object)node).getClass()})); //"DOM2Helper can not handle nodes of type" - //+((Object)node).getClass()); - } + /** + * Construct an instance. + */ + private DOM2Helper() { + } - /** - * Returns true if the DOM implementation handled by this helper - * supports the SAX ContentHandler interface. - * - * @return true (since Xerces does). - */ - public boolean supportsSAX() - { - return true; - } - - /** Field m_doc: Document Node for the document this helper is currently - * accessing or building - * @see #setDocument - * @see #getDocument - * */ - private Document m_doc; + /** + * Returns the local name of the given node, as defined by the XML + * Namespaces specification. This is prepared to handle documents built + * using DOM Level 1 methods by falling back upon explicitly parsing the + * node name. + * + * @param n Node to be examined + * + * @return String containing the local name, or null if the node was not + * assigned a Namespace. + */ + public static String getLocalNameOfNode(Node n) { - /** - * Specify which document this helper is currently operating on. - * - * @param doc The DOM Document node for this document. - * @see #getDocument - */ - public void setDocument(Document doc) - { - m_doc = doc; - } + String name = n.getLocalName(); - /** - * Query which document this helper is currently operating on. - * - * @return The DOM Document node for this document. - * @see #setDocument - */ - public Document getDocument() - { - return m_doc; - } + return (null == name) ? getLocalNameOfNodeFallback(n) : name; + } - /** - * Parse an XML document. - * - *
Right now the Xerces DOMParser class is used. This needs - * fixing, either via jaxp, or via some other, standard method.
- * - *The application can use this method to instruct the SAX parser - * to begin parsing an XML document from any valid input - * source (a character stream, a byte stream, or a URI).
- * - *Applications may not invoke this method while a parse is in - * progress (they should create a new Parser instead for each - * additional XML document). Once a parse is complete, an - * application may reuse the same Parser object, possibly with a - * different input source.
- * - * @param source The input source for the top-level of the - * XML document. - * - * @throws TransformerException if any checked exception is thrown. - * @xsl.usage internal - */ - public void parse(InputSource source) throws TransformerException - { + /** + * Returns the local name of the given node. If the node's name begins with + * a namespace prefix, this is the part after the colon; otherwise it's the + * full node name. + * + * This method is copied from + * com.sun.org.apache.xml.internal.utils.DOMHelper + * + * @param n the node to be examined. + * + * @return String containing the Local Name + */ + private static String getLocalNameOfNodeFallback(Node n) { - try - { - - // I guess I should use JAXP factory here... when it's legal. - // com.sun.org.apache.xerces.internal.parsers.DOMParser parser - // = new com.sun.org.apache.xerces.internal.parsers.DOMParser(); - DocumentBuilderFactory builderFactory = - DocumentBuilderFactory.newInstance(); - - builderFactory.setNamespaceAware(true); - builderFactory.setValidating(true); + String qname = n.getNodeName(); + int index = qname.indexOf(':'); - DocumentBuilder parser = builderFactory.newDocumentBuilder(); - - /* - // domParser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes", getShouldExpandEntityRefs()? false : true); - if(m_useDOM2getNamespaceURI) - { - parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", true); - parser.setFeature("http://xml.org/sax/features/namespaces", true); - } - else - { - parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false); - } - - parser.setFeature("http://apache.org/xml/features/allow-java-encodings", true); - */ + return (index < 0) ? qname : qname.substring(index + 1); + } - parser.setErrorHandler( - new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler()); - - // if(null != m_entityResolver) - // { - // System.out.println("Setting the entity resolver."); - // parser.setEntityResolver(m_entityResolver); - // } - setDocument(parser.parse(source)); - } - catch (org.xml.sax.SAXException se) - { - throw new TransformerException(se); - } - catch (ParserConfigurationException pce) - { - throw new TransformerException(pce); - } - catch (IOException ioe) - { - throw new TransformerException(ioe); + /** + * Returns the Namespace Name (Namespace URI) for the given node. In a Level + * 2 DOM, you can ask the node itself. Note, however, that doing so + * conflicts with our decision in getLocalNameOfNode not to trust the that + * the DOM was indeed created using the Level 2 methods. If Level 1 methods + * were used, these two functions will disagree with each other. + *+ * TODO: Reconcile with getLocalNameOfNode. + * + * @param n Node to be examined + * + * @return String containing the Namespace URI bound to this DOM node at the + * time the Node was created. + */ + public static String getNamespaceOfNode(Node n) { + return n.getNamespaceURI(); } - // setDocument(((com.sun.org.apache.xerces.internal.parsers.DOMParser)parser).getDocument()); - } + /** + * Figure out whether node2 should be considered as being later in the + * document than node1, in Document Order as defined by the XPath model. + * This may not agree with the ordering defined by other XML applications. + *
+ * There are some cases where ordering isn't defined, and neither are the + * results of this function -- though we'll generally return true. + * + * @param node1 DOM Node to perform position comparison on. + * @param node2 DOM Node to perform position comparison on . + * + * @return false if node2 comes before node1, otherwise return true. You can + * think of this as + * {@code (node1.documentOrderPosition <= node2.documentOrderPosition)}. + */ + public static boolean isNodeAfter(Node node1, Node node2) { + if (node1 == node2 || isNodeTheSame(node1, node2)) { + return true; + } + + // Default return value, if there is no defined ordering + boolean isNodeAfter = true; + + Node parent1 = getParentOfNode(node1); + Node parent2 = getParentOfNode(node2); - /** - * Given an XML ID, return the element. This requires assistance from the - * DOM and parser, and is meaningful only in the context of a DTD - * or schema which declares attributes as being of type ID. This - * information may or may not be available in all parsers, may or - * may not be available for specific documents, and may or may not - * be available when validation is not turned on. - * - * @param id The ID to search for, as a String. - * @param doc The document to search within, as a DOM Document node. - * @return DOM Element node with an attribute of type ID whose value - * uniquely matches the requested id string, or null if there isn't - * such an element or if the DOM can't answer the question for other - * reasons. - */ - public Element getElementByID(String id, Document doc) - { - return doc.getElementById(id); - } + // Optimize for most common case + if (parent1 == parent2 || isNodeTheSame(parent1, parent2)) // then we know they are siblings + { + if (null != parent1) { + isNodeAfter = isNodeAfterSibling(parent1, node1, node2); + } + } else { + // General strategy: Figure out the lengths of the two + // ancestor chains, reconcile the lengths, and look for + // the lowest common ancestor. If that ancestor is one of + // the nodes being compared, it comes before the other. + // Otherwise perform a sibling compare. + // + // NOTE: If no common ancestor is found, ordering is undefined + // and we return the default value of isNodeAfter. + // Count parents in each ancestor chain + int nParents1 = 2, nParents2 = 2; // include node & parent obtained above + + while (parent1 != null) { + nParents1++; + + parent1 = getParentOfNode(parent1); + } + + while (parent2 != null) { + nParents2++; - /** - * Figure out whether node2 should be considered as being later - * in the document than node1, in Document Order as defined - * by the XPath model. This may not agree with the ordering defined - * by other XML applications. - *
- * There are some cases where ordering isn't defined, and neither are - * the results of this function -- though we'll generally return true. - *
- * TODO: Make sure this does the right thing with attribute nodes!!!
- *
- * @param node1 DOM Node to perform position comparison on.
- * @param node2 DOM Node to perform position comparison on .
- *
- * @return false if node2 comes before node1, otherwise return true.
- * You can think of this as
- * (node1.documentOrderPosition <= node2.documentOrderPosition)
.
- */
- public static boolean isNodeAfter(Node node1, Node node2)
- {
+ parent2 = getParentOfNode(parent2);
+ }
+
+ // Initially assume scan for common ancestor starts with
+ // the input nodes.
+ Node startNode1 = node1, startNode2 = node2;
+
+ // If one ancestor chain is longer, adjust its start point
+ // so we're comparing at the same depths
+ if (nParents1 < nParents2) {
+ // Adjust startNode2 to depth of startNode1
+ int adjust = nParents2 - nParents1;
+
+ for (int i = 0; i < adjust; i++) {
+ startNode2 = getParentOfNode(startNode2);
+ }
+ } else if (nParents1 > nParents2) {
+ // adjust startNode1 to depth of startNode2
+ int adjust = nParents1 - nParents2;
+
+ for (int i = 0; i < adjust; i++) {
+ startNode1 = getParentOfNode(startNode1);
+ }
+ }
+
+ Node prevChild1 = null, prevChild2 = null; // so we can "back up"
- // Assume first that the nodes are DTM nodes, since discovering node
- // order is massivly faster for the DTM.
- if(node1 instanceof DOMOrder && node2 instanceof DOMOrder)
- {
- int index1 = ((DOMOrder) node1).getUid();
- int index2 = ((DOMOrder) node2).getUid();
+ // Loop up the ancestor chain looking for common parent
+ while (null != startNode1) {
+ if (startNode1 == startNode2 || isNodeTheSame(startNode1, startNode2)) // common parent?
+ {
+ if (null == prevChild1) // first time in loop?
+ {
+
+ // Edge condition: one is the ancestor of the other.
+ isNodeAfter = (nParents1 < nParents2) ? true : false;
- return index1 <= index2;
- }
- else
- {
+ break; // from while loop
+ } else {
+ // Compare ancestors below lowest-common as siblings
+ isNodeAfter = isNodeAfterSibling(startNode1, prevChild1,
+ prevChild2);
+
+ break; // from while loop
+ }
+ } // end if(startNode1 == startNode2)
- // isNodeAfter will return true if node is after countedNode
- // in document order. The base isNodeAfter is sloooow (relatively).
- return DOMHelper.isNodeAfter(node1, node2);
- }
- }
+ // Move up one level and try again
+ prevChild1 = startNode1;
+ startNode1 = getParentOfNode(startNode1);
+ prevChild2 = startNode2;
+ startNode2 = getParentOfNode(startNode2);
+ } // end while(parents exist to examine)
+ } // end big else (not immediate siblings)
+
+ return isNodeAfter;
+ } // end isNodeAfter(Node node1, Node node2)
- /**
- * Get the XPath-model parent of a node. This version takes advantage
- * of the DOM Level 2 Attr.ownerElement() method; the base version we
- * would otherwise inherit is prepared to fall back on exhaustively
- * walking the document to find an Attr's parent.
- *
- * @param node Node to be examined
- *
- * @return the DOM parent of the input node, if there is one, or the
- * ownerElement if the input node is an Attr, or null if the node is
- * a Document, a DocumentFragment, or an orphan.
- */
- public static Node getParentOfNode(Node node)
- {
- Node parent=node.getParentNode();
- if(parent==null && (Node.ATTRIBUTE_NODE == node.getNodeType()) )
- parent=((Attr) node).getOwnerElement();
- return parent;
- }
+ /**
+ * Use DTMNodeProxy to determine whether two nodes are the same.
+ *
+ * @param node1 The first DOM node to compare.
+ * @param node2 The second DOM node to compare.
+ * @return true if the two nodes are the same.
+ */
+ public static boolean isNodeTheSame(Node node1, Node node2) {
+ if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy) {
+ return ((DTMNodeProxy) node1).equals((DTMNodeProxy) node2);
+ } else {
+ return (node1 == node2);
+ }
+ }
+
+ /**
+ * Get the XPath-model parent of a node. This version takes advantage of the
+ * DOM Level 2 Attr.ownerElement() method; the base version we would
+ * otherwise inherit is prepared to fall back on exhaustively walking the
+ * document to find an Attr's parent.
+ *
+ * @param node Node to be examined
+ *
+ * @return the DOM parent of the input node, if there is one, or the
+ * ownerElement if the input node is an Attr, or null if the node is a
+ * Document, a DocumentFragment, or an orphan.
+ */
+ public static Node getParentOfNode(Node node) {
+ Node parent = node.getParentNode();
+ if (parent == null && (Node.ATTRIBUTE_NODE == node.getNodeType())) {
+ parent = ((Attr) node).getOwnerElement();
+ }
+ return parent;
+ }
+
+ /**
+ * Figure out if child2 is after child1 in document order.
+ *
+ * Warning: Some aspects of "document order" are not well defined. For + * example, the order of attributes is considered meaningless in XML, and + * the order reported by our model will be consistent for a given invocation + * but may not match that of either the source file or the serialized + * output. + * + * @param parent Must be the parent of both child1 and child2. + * @param child1 Must be the child of parent and not equal to child2. + * @param child2 Must be the child of parent and not equal to child1. + * @return true if child 2 is after child1 in document order. + */ + private static boolean isNodeAfterSibling(Node parent, Node child1, + Node child2) { + + boolean isNodeAfterSibling = false; + short child1type = child1.getNodeType(); + short child2type = child2.getNodeType(); + + if ((Node.ATTRIBUTE_NODE != child1type) + && (Node.ATTRIBUTE_NODE == child2type)) { + + // always sort attributes before non-attributes. + isNodeAfterSibling = false; + } else if ((Node.ATTRIBUTE_NODE == child1type) + && (Node.ATTRIBUTE_NODE != child2type)) { - /** - * Returns the local name of the given node, as defined by the - * XML Namespaces specification. This is prepared to handle documents - * built using DOM Level 1 methods by falling back upon explicitly - * parsing the node name. - * - * @param n Node to be examined - * - * @return String containing the local name, or null if the node - * was not assigned a Namespace. - */ - public String getLocalNameOfNode(Node n) - { + // always sort attributes before non-attributes. + isNodeAfterSibling = true; + } else if (Node.ATTRIBUTE_NODE == child1type) { + NamedNodeMap children = parent.getAttributes(); + int nNodes = children.getLength(); + boolean found1 = false, found2 = false; + + // Count from the start until we find one or the other. + for (int i = 0; i < nNodes; i++) { + Node child = children.item(i); - String name = n.getLocalName(); + if (child1 == child || isNodeTheSame(child1, child)) { + if (found2) { + isNodeAfterSibling = false; + + break; + } - return (null == name) ? super.getLocalNameOfNode(n) : name; - } + found1 = true; + } else if (child2 == child || isNodeTheSame(child2, child)) { + if (found1) { + isNodeAfterSibling = true; + + break; + } - /** - * Returns the Namespace Name (Namespace URI) for the given node. - * In a Level 2 DOM, you can ask the node itself. Note, however, that - * doing so conflicts with our decision in getLocalNameOfNode not - * to trust the that the DOM was indeed created using the Level 2 - * methods. If Level 1 methods were used, these two functions will - * disagree with each other. - *
- * TODO: Reconcile with getLocalNameOfNode. - * - * @param n Node to be examined - * - * @return String containing the Namespace URI bound to this DOM node - * at the time the Node was created. - */ - public String getNamespaceOfNode(Node n) - { - return n.getNamespaceURI(); - } + found2 = true; + } + } + } else { + // TODO: Check performance of alternate solution: + // There are two choices here: Count from the start of + // the document until we find one or the other, or count + // from one until we find or fail to find the other. + // Either can wind up scanning all the siblings in the worst + // case, which on a wide document can be a lot of work but + // is more typically is a short list. + // Scanning from the start involves two tests per iteration, + // but it isn't clear that scanning from the middle doesn't + // yield more iterations on average. + // We should run some testcases. + Node child = parent.getFirstChild(); + boolean found1 = false, found2 = false; + + while (null != child) { - /** Field m_useDOM2getNamespaceURI is a compile-time flag which - * gates some of the parser options used to build a DOM -- but - * that code is commented out at this time and nobody else - * references it, so I've commented this out as well. */ - //private boolean m_useDOM2getNamespaceURI = false; + // Node child = children.item(i); + if (child1 == child || isNodeTheSame(child1, child)) { + if (found2) { + isNodeAfterSibling = false; + + break; + } + + found1 = true; + } else if (child2 == child || isNodeTheSame(child2, child)) { + if (found1) { + isNodeAfterSibling = true; + + break; + } + + found2 = true; + } + + child = child.getNextSibling(); + } + } + + return isNodeAfterSibling; + } // end isNodeAfterSibling(Node parent, Node child1, Node child2) } diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMHelper.java --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMHelper.java Wed Jun 14 20:02:36 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1330 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * $Id: DOMHelper.java,v 1.2.4.1 2005/09/15 08:15:40 suresh_emailid Exp $ - */ -package com.sun.org.apache.xml.internal.utils; - -import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy; -import com.sun.org.apache.xml.internal.res.XMLErrorResources; -import com.sun.org.apache.xml.internal.res.XMLMessages; -import java.util.HashMap; -import java.util.Map; -import java.util.Vector; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.Attr; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; -import org.w3c.dom.Element; -import org.w3c.dom.Entity; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.Text; - -/** - * @deprecated Since the introduction of the DTM, this class will be removed. - * This class provides a front-end to DOM implementations, providing - * a number of utility functions that either aren't yet standardized - * by the DOM spec or that are defined in optional DOM modules and - * hence may not be present in all DOMs. - */ -public class DOMHelper -{ - - /** - * DOM Level 1 did not have a standard mechanism for creating a new - * Document object. This function provides a DOM-implementation-independent - * abstraction for that for that concept. It's typically used when - * outputting a new DOM as the result of an operation. - *
- * TODO: This isn't directly compatable with DOM Level 2. - * The Level 2 createDocument call also creates the root - * element, and thus requires that you know what that element will be - * before creating the Document. We should think about whether we want - * to change this code, and the callers, so we can use the DOM's own - * method. (It's also possible that DOM Level 3 may relax this - * sequence, but you may give up some intelligence in the DOM by - * doing so; the intent was that knowing the document type and root - * element might let the DOM automatically switch to a specialized - * subclass for particular kinds of documents.) - * - * @param isSecureProcessing state of the secure processing feature. - * @return The newly created DOM Document object, with no children, or - * null if we can't find a DOM implementation that permits creating - * new empty Documents. - */ - public static Document createDocument(boolean isSecureProcessing) - { - - try - { - - // Use an implementation of the JAVA API for XML Parsing 1.0 to - // create a DOM Document node to contain the result. - DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); - - dfactory.setNamespaceAware(true); - dfactory.setValidating(true); - - if (isSecureProcessing) - { - try - { - dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } - catch (ParserConfigurationException pce) {} - } - - DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); - Document outNode = docBuilder.newDocument(); - - return outNode; - } - catch (ParserConfigurationException pce) - { - throw new RuntimeException( - XMLMessages.createXMLMessage( - XMLErrorResources.ER_CREATEDOCUMENT_NOT_SUPPORTED, null)); //"createDocument() not supported in XPathContext!"); - - // return null; - } - } - - /** - * DOM Level 1 did not have a standard mechanism for creating a new - * Document object. This function provides a DOM-implementation-independent - * abstraction for that for that concept. It's typically used when - * outputting a new DOM as the result of an operation. - * - * @return The newly created DOM Document object, with no children, or - * null if we can't find a DOM implementation that permits creating - * new empty Documents. - */ - public static Document createDocument() - { - return createDocument(false); - } - - /** - * Tells, through the combination of the default-space attribute - * on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the - * xml:space attribute, whether or not extra whitespace should be stripped - * from the node. Literal elements from template elements should - * not be tested with this function. - * @param textNode A text node from the source tree. - * @return true if the text node should be stripped of extra whitespace. - * - * @throws javax.xml.transform.TransformerException - * @xsl.usage advanced - */ - public boolean shouldStripSourceNode(Node textNode) - throws javax.xml.transform.TransformerException - { - - // return (null == m_envSupport) ? false : m_envSupport.shouldStripSourceNode(textNode); - return false; - } - - /** - * Supports the XPath function GenerateID by returning a unique - * identifier string for any given DOM Node. - *
- * Warning: The base implementation uses the Node object's hashCode(), - * which is NOT guaranteed to be unique. If that method hasn't been - * overridden in this DOM ipmlementation, most Java implementions will - * derive it from the object's address and should be OK... but if - * your DOM uses a different definition of hashCode (eg hashing the - * contents of the subtree), or if your DOM may have multiple objects - * that represent a single Node in the data structure (eg via proxying), - * you may need to find another way to assign a unique identifier. - *
- * Also, be aware that if nodes are destroyed and recreated, there is - * an open issue regarding whether an ID may be reused. Currently - * we're assuming that the input document is stable for the duration - * of the XPath/XSLT operation, so this shouldn't arise in this context. - *
- * (DOM Level 3 is investigating providing a unique node "key", but - * that won't help Level 1 and Level 2 implementations.) - * - * @param node whose identifier you want to obtain - * - * @return a string which should be different for every Node object. - */ - public String getUniqueID(Node node) - { - return "N" + Integer.toHexString(node.hashCode()).toUpperCase(); - } - - /** - * Figure out whether node2 should be considered as being later - * in the document than node1, in Document Order as defined - * by the XPath model. This may not agree with the ordering defined - * by other XML applications. - *
- * There are some cases where ordering isn't defined, and neither are
- * the results of this function -- though we'll generally return true.
- *
- * TODO: Make sure this does the right thing with attribute nodes!!!
- *
- * @param node1 DOM Node to perform position comparison on.
- * @param node2 DOM Node to perform position comparison on .
- *
- * @return false if node2 comes before node1, otherwise return true.
- * You can think of this as
- * (node1.documentOrderPosition <= node2.documentOrderPosition)
.
- */
- public static boolean isNodeAfter(Node node1, Node node2)
- {
- if (node1 == node2 || isNodeTheSame(node1, node2))
- return true;
-
- // Default return value, if there is no defined ordering
- boolean isNodeAfter = true;
-
- Node parent1 = getParentOfNode(node1);
- Node parent2 = getParentOfNode(node2);
-
- // Optimize for most common case
- if (parent1 == parent2 || isNodeTheSame(parent1, parent2)) // then we know they are siblings
- {
- if (null != parent1)
- isNodeAfter = isNodeAfterSibling(parent1, node1, node2);
- else
- {
- // If both parents are null, ordering is not defined.
- // We're returning a value in lieu of throwing an exception.
- // Not a case we expect to arise in XPath, but beware if you
- // try to reuse this method.
-
- // We can just fall through in this case, which allows us
- // to hit the debugging code at the end of the function.
- //return isNodeAfter;
- }
- }
- else
- {
-
- // General strategy: Figure out the lengths of the two
- // ancestor chains, reconcile the lengths, and look for
- // the lowest common ancestor. If that ancestor is one of
- // the nodes being compared, it comes before the other.
- // Otherwise perform a sibling compare.
- //
- // NOTE: If no common ancestor is found, ordering is undefined
- // and we return the default value of isNodeAfter.
-
- // Count parents in each ancestor chain
- int nParents1 = 2, nParents2 = 2; // include node & parent obtained above
-
- while (parent1 != null)
- {
- nParents1++;
-
- parent1 = getParentOfNode(parent1);
- }
-
- while (parent2 != null)
- {
- nParents2++;
-
- parent2 = getParentOfNode(parent2);
- }
-
- // Initially assume scan for common ancestor starts with
- // the input nodes.
- Node startNode1 = node1, startNode2 = node2;
-
- // If one ancestor chain is longer, adjust its start point
- // so we're comparing at the same depths
- if (nParents1 < nParents2)
- {
- // Adjust startNode2 to depth of startNode1
- int adjust = nParents2 - nParents1;
-
- for (int i = 0; i < adjust; i++)
- {
- startNode2 = getParentOfNode(startNode2);
- }
- }
- else if (nParents1 > nParents2)
- {
- // adjust startNode1 to depth of startNode2
- int adjust = nParents1 - nParents2;
-
- for (int i = 0; i < adjust; i++)
- {
- startNode1 = getParentOfNode(startNode1);
- }
- }
-
- Node prevChild1 = null, prevChild2 = null; // so we can "back up"
-
- // Loop up the ancestor chain looking for common parent
- while (null != startNode1)
- {
- if (startNode1 == startNode2 || isNodeTheSame(startNode1, startNode2)) // common parent?
- {
- if (null == prevChild1) // first time in loop?
- {
-
- // Edge condition: one is the ancestor of the other.
- isNodeAfter = (nParents1 < nParents2) ? true : false;
-
- break; // from while loop
- }
- else
- {
- // Compare ancestors below lowest-common as siblings
- isNodeAfter = isNodeAfterSibling(startNode1, prevChild1,
- prevChild2);
-
- break; // from while loop
- }
- } // end if(startNode1 == startNode2)
-
- // Move up one level and try again
- prevChild1 = startNode1;
- startNode1 = getParentOfNode(startNode1);
- prevChild2 = startNode2;
- startNode2 = getParentOfNode(startNode2);
- } // end while(parents exist to examine)
- } // end big else (not immediate siblings)
-
- // WARNING: The following diagnostic won't report the early
- // "same node" case. Fix if/when needed.
-
- /* -- please do not remove... very useful for diagnostics --
- System.out.println("node1 = "+node1.getNodeName()+"("+node1.getNodeType()+")"+
- ", node2 = "+node2.getNodeName()
- +"("+node2.getNodeType()+")"+
- ", isNodeAfter = "+isNodeAfter); */
- return isNodeAfter;
- } // end isNodeAfter(Node node1, Node node2)
-
- /**
- * Use DTMNodeProxy to determine whether two nodes are the same.
- *
- * @param node1 The first DOM node to compare.
- * @param node2 The second DOM node to compare.
- * @return true if the two nodes are the same.
- */
- public static boolean isNodeTheSame(Node node1, Node node2)
- {
- if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy)
- return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2);
- else
- return (node1 == node2);
- }
-
- /**
- * Figure out if child2 is after child1 in document order.
- *
- * Warning: Some aspects of "document order" are not well defined.
- * For example, the order of attributes is considered
- * meaningless in XML, and the order reported by our model will
- * be consistant for a given invocation but may not
- * match that of either the source file or the serialized output.
- *
- * @param parent Must be the parent of both child1 and child2.
- * @param child1 Must be the child of parent and not equal to child2.
- * @param child2 Must be the child of parent and not equal to child1.
- * @return true if child 2 is after child1 in document order.
- */
- private static boolean isNodeAfterSibling(Node parent, Node child1,
- Node child2)
- {
-
- boolean isNodeAfterSibling = false;
- short child1type = child1.getNodeType();
- short child2type = child2.getNodeType();
-
- if ((Node.ATTRIBUTE_NODE != child1type)
- && (Node.ATTRIBUTE_NODE == child2type))
- {
-
- // always sort attributes before non-attributes.
- isNodeAfterSibling = false;
- }
- else if ((Node.ATTRIBUTE_NODE == child1type)
- && (Node.ATTRIBUTE_NODE != child2type))
- {
-
- // always sort attributes before non-attributes.
- isNodeAfterSibling = true;
- }
- else if (Node.ATTRIBUTE_NODE == child1type)
- {
- NamedNodeMap children = parent.getAttributes();
- int nNodes = children.getLength();
- boolean found1 = false, found2 = false;
-
- // Count from the start until we find one or the other.
- for (int i = 0; i < nNodes; i++)
- {
- Node child = children.item(i);
-
- if (child1 == child || isNodeTheSame(child1, child))
- {
- if (found2)
- {
- isNodeAfterSibling = false;
-
- break;
- }
-
- found1 = true;
- }
- else if (child2 == child || isNodeTheSame(child2, child))
- {
- if (found1)
- {
- isNodeAfterSibling = true;
-
- break;
- }
-
- found2 = true;
- }
- }
- }
- else
- {
- // TODO: Check performance of alternate solution:
- // There are two choices here: Count from the start of
- // the document until we find one or the other, or count
- // from one until we find or fail to find the other.
- // Either can wind up scanning all the siblings in the worst
- // case, which on a wide document can be a lot of work but
- // is more typically is a short list.
- // Scanning from the start involves two tests per iteration,
- // but it isn't clear that scanning from the middle doesn't
- // yield more iterations on average.
- // We should run some testcases.
- Node child = parent.getFirstChild();
- boolean found1 = false, found2 = false;
-
- while (null != child)
- {
-
- // Node child = children.item(i);
- if (child1 == child || isNodeTheSame(child1, child))
- {
- if (found2)
- {
- isNodeAfterSibling = false;
-
- break;
- }
-
- found1 = true;
- }
- else if (child2 == child || isNodeTheSame(child2, child))
- {
- if (found1)
- {
- isNodeAfterSibling = true;
-
- break;
- }
-
- found2 = true;
- }
-
- child = child.getNextSibling();
- }
- }
-
- return isNodeAfterSibling;
- } // end isNodeAfterSibling(Node parent, Node child1, Node child2)
-
- //==========================================================
- // SECTION: Namespace resolution
- //==========================================================
-
- /**
- * Get the depth level of this node in the tree (equals 1 for
- * a parentless node).
- *
- * @param n Node to be examined.
- * @return the number of ancestors, plus one
- * @xsl.usage internal
- */
- public short getLevel(Node n)
- {
-
- short level = 1;
-
- while (null != (n = getParentOfNode(n)))
- {
- level++;
- }
-
- return level;
- }
-
- /**
- * Given an XML Namespace prefix and a context in which the prefix
- * is to be evaluated, return the Namespace Name this prefix was
- * bound to. Note that DOM Level 3 is expected to provide a version of
- * this which deals with the DOM's "early binding" behavior.
- *
- * Default handling:
- *
- * @param prefix String containing namespace prefix to be resolved,
- * without the ':' which separates it from the localname when used
- * in a Node Name. The empty sting signifies the default namespace
- * at this point in the document.
- * @param namespaceContext Element which provides context for resolution.
- * (We could extend this to work for other nodes by first seeking their
- * nearest Element ancestor.)
- *
- * @return a String containing the Namespace URI which this prefix
- * represents in the specified context.
- */
- public String getNamespaceForPrefix(String prefix, Element namespaceContext)
- {
-
- int type;
- Node parent = namespaceContext;
- String namespace = null;
-
- if (prefix.equals("xml"))
- {
- namespace = QName.S_XMLNAMESPACEURI; // Hardcoded, per Namespace spec
- }
- else if(prefix.equals("xmlns"))
- {
- // Hardcoded in the DOM spec, expected to be adopted by
- // Namespace spec. NOTE: Namespace declarations _must_ use
- // the xmlns: prefix; other prefixes declared as belonging
- // to this namespace will not be recognized and should
- // probably be rejected by parsers as erroneous declarations.
- namespace = "http://www.w3.org/2000/xmlns/";
- }
- else
- {
- // Attribute name for this prefix's declaration
- String declname=(prefix=="")
- ? "xmlns"
- : "xmlns:"+prefix;
-
- // Scan until we run out of Elements or have resolved the namespace
- while ((null != parent) && (null == namespace)
- && (((type = parent.getNodeType()) == Node.ELEMENT_NODE)
- || (type == Node.ENTITY_REFERENCE_NODE)))
- {
- if (type == Node.ELEMENT_NODE)
- {
-
- // Look for the appropriate Namespace Declaration attribute,
- // either "xmlns:prefix" or (if prefix is "") "xmlns".
- // TODO: This does not handle "implicit declarations"
- // which may be created when the DOM is edited. DOM Level
- // 3 will define how those should be interpreted. But
- // this issue won't arise in freshly-parsed DOMs.
-
- // NOTE: declname is set earlier, outside the loop.
- Attr attr=((Element)parent).getAttributeNode(declname);
- if(attr!=null)
- {
- namespace = attr.getNodeValue();
- break;
- }
- }
-
- parent = getParentOfNode(parent);
- }
- }
-
- return namespace;
- }
-
- /**
- * An experiment for the moment.
- */
- Map
- * TODO: This doesn't handle DocumentFragments or "orphaned" subtrees
- * -- it's currently returning ownerDocument even when the tree is
- * not actually part of the main Document tree. We should either
- * rewrite the description to say that it finds the Document node,
- * or change the code to walk up the ancestor chain.
-
- *
- * @param n Node to be examined
- *
- * @return the Document node. Note that this is not the correct answer
- * if n was (or was a child of) a DocumentFragment or an orphaned node,
- * as can arise if the DOM has been edited rather than being generated
- * by a parser.
- */
- public Node getRootNode(Node n)
- {
- int nt = n.getNodeType();
- return ( (Node.DOCUMENT_NODE == nt) || (Node.DOCUMENT_FRAGMENT_NODE == nt) )
- ? n : n.getOwnerDocument();
- }
-
- /**
- * Test whether the given node is a namespace decl node. In DOM Level 2
- * this can be done in a namespace-aware manner, but in Level 1 DOMs
- * it has to be done by testing the node name.
- *
- * @param n Node to be examined.
- *
- * @return boolean -- true iff the node is an Attr whose name is
- * "xmlns" or has the "xmlns:" prefix.
- */
- public boolean isNamespaceNode(Node n)
- {
-
- if (Node.ATTRIBUTE_NODE == n.getNodeType())
- {
- String attrName = n.getNodeName();
-
- return (attrName.startsWith("xmlns:") || attrName.equals("xmlns"));
- }
-
- return false;
- }
-
- /**
- * Obtain the XPath-model parent of a DOM node -- ownerElement for Attrs,
- * parent for other nodes.
- *
- * Background: The DOM believes that you must be your Parent's
- * Child, and thus Attrs don't have parents. XPath said that Attrs
- * do have their owning Element as their parent. This function
- * bridges the difference, either by using the DOM Level 2 ownerElement
- * function or by using a "silly and expensive function" in Level 1
- * DOMs.
- *
- * (There's some discussion of future DOMs generalizing ownerElement
- * into ownerNode and making it work on all types of nodes. This
- * still wouldn't help the users of Level 1 or Level 2 DOMs)
- *
- *
- * @param node Node whose XPath parent we want to obtain
- *
- * @return the parent of the node, or the ownerElement if it's an
- * Attr node, or null if the node is an orphan.
- *
- * @throws RuntimeException if the Document has no root element.
- * This can't arise if the Document was created
- * via the DOM Level 2 factory methods, but is possible if other
- * mechanisms were used to obtain it
- */
- public static Node getParentOfNode(Node node) throws RuntimeException
- {
- Node parent;
- short nodeType = node.getNodeType();
-
- if (Node.ATTRIBUTE_NODE == nodeType)
- {
- Document doc = node.getOwnerDocument();
- /*
- TBD:
- if(null == doc)
- {
- throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT, null));//"Attribute child does not have an owner document!");
- }
- */
-
- // Given how expensive the tree walk may be, we should first ask
- // whether this DOM can answer the question for us. The additional
- // test does slow down Level 1 DOMs slightly. DOMHelper2, which
- // is currently specialized for Xerces, assumes it can use the
- // Level 2 solution. We might want to have an intermediate stage,
- // which would assume DOM Level 2 but not assume Xerces.
- //
- // (Shouldn't have to check whether impl is null in a compliant DOM,
- // but let's be paranoid for a moment...)
- DOMImplementation impl=doc.getImplementation();
- if(impl!=null && impl.hasFeature("Core","2.0"))
- {
- parent=((Attr)node).getOwnerElement();
- return parent;
- }
-
- // DOM Level 1 solution, as fallback. Hugely expensive.
-
- Element rootElem = doc.getDocumentElement();
-
- if (null == rootElem)
- {
- throw new RuntimeException(
- XMLMessages.createXMLMessage(
- XMLErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT,
- null)); //"Attribute child does not have an owner document element!");
- }
-
- parent = locateAttrParent(rootElem, node);
-
- }
- else
- {
- parent = node.getParentNode();
-
- // if((Node.DOCUMENT_NODE != nodeType) && (null == parent))
- // {
- // throw new RuntimeException("Child does not have parent!");
- // }
- }
-
- return parent;
- }
-
- /**
- * Given an ID, return the element. This can work only if the document
- * is interpreted in the context of a DTD or Schema, since otherwise
- * we don't know which attributes are or aren't IDs.
- *
- * Note that DOM Level 1 had no ability to retrieve this information.
- * DOM Level 2 introduced it but does not promise that it will be
- * supported in all DOMs; those which can't support it will always
- * return null.
- *
- * TODO: getElementByID is currently unimplemented. Support DOM Level 2?
- *
- * @param id The unique identifier to be searched for.
- * @param doc The document to search within.
- * @return CURRENTLY HARDCODED TO NULL, but it should be:
- * The node which has this unique identifier, or null if there
- * is no such node or this DOM can't reliably recognize it.
- */
- public Element getElementByID(String id, Document doc)
- {
- return null;
- }
-
- /**
- * The getUnparsedEntityURI function returns the URI of the unparsed
- * entity with the specified name in the same document as the context
- * node (see [3.3 Unparsed Entities]). It returns the empty string if
- * there is no such entity.
- *
- * XML processors may choose to use the System Identifier (if one
- * is provided) to resolve the entity, rather than the URI in the
- * Public Identifier. The details are dependent on the processor, and
- * we would have to support some form of plug-in resolver to handle
- * this properly. Currently, we simply return the System Identifier if
- * present, and hope that it a usable URI or that our caller can
- * map it to one.
- * TODO: Resolve Public Identifiers... or consider changing function name.
- *
- * If we find a relative URI
- * reference, XML expects it to be resolved in terms of the base URI
- * of the document. The DOM doesn't do that for us, and it isn't
- * entirely clear whether that should be done here; currently that's
- * pushed up to a higher levelof our application. (Note that DOM Level
- * 1 didn't store the document's base URI.)
- * TODO: Consider resolving Relative URIs.
- *
- * (The DOM's statement that "An XML processor may choose to
- * completely expand entities before the structure model is passed
- * to the DOM" refers only to parsed entities, not unparsed, and hence
- * doesn't affect this function.)
- *
- * @param name A string containing the Entity Name of the unparsed
- * entity.
- * @param doc Document node for the document to be searched.
- *
- * @return String containing the URI of the Unparsed Entity, or an
- * empty string if no such entity exists.
- */
- public String getUnparsedEntityURI(String name, Document doc)
- {
-
- String url = "";
- DocumentType doctype = doc.getDoctype();
-
- if (null != doctype)
- {
- NamedNodeMap entities = doctype.getEntities();
- if(null == entities)
- return url;
- Entity entity = (Entity) entities.getNamedItem(name);
- if(null == entity)
- return url;
-
- String notationName = entity.getNotationName();
-
- if (null != notationName) // then it's unparsed
- {
- // The draft says: "The XSLT processor may use the public
- // identifier to generate a URI for the entity instead of the URI
- // specified in the system identifier. If the XSLT processor does
- // not use the public identifier to generate the URI, it must use
- // the system identifier; if the system identifier is a relative
- // URI, it must be resolved into an absolute URI using the URI of
- // the resource containing the entity declaration as the base
- // URI [RFC2396]."
- // So I'm falling a bit short here.
- url = entity.getSystemId();
-
- if (null == url)
- {
- url = entity.getPublicId();
- }
- else
- {
- // This should be resolved to an absolute URL, but that's hard
- // to do from here.
- }
- }
- }
-
- return url;
- }
-
- /**
- * Support for getParentOfNode; walks a DOM tree until it finds
- * the Element which owns the Attr. This is hugely expensive, and
- * if at all possible you should use the DOM Level 2 Attr.ownerElement()
- * method instead.
- *
- * The DOM Level 1 developers expected that folks would keep track
- * of the last Element they'd seen and could recover the info from
- * that source. Obviously that doesn't work very well if the only
- * information you've been presented with is the Attr. The DOM Level 2
- * getOwnerElement() method fixes that, but only for Level 2 and
- * later DOMs.
- *
- * @param elem Element whose subtree is to be searched for this Attr
- * @param attr Attr whose owner is to be located.
- *
- * @return the first Element whose attribute list includes the provided
- * attr. In modern DOMs, this will also be the only such Element. (Early
- * DOMs had some hope that Attrs might be sharable, but this idea has
- * been abandoned.)
- */
- private static Node locateAttrParent(Element elem, Node attr)
- {
-
- Node parent = null;
-
- // This should only be called for Level 1 DOMs, so we don't have to
- // worry about namespace issues. In later levels, it's possible
- // for a DOM to have two Attrs with the same NodeName but
- // different namespaces, and we'd need to get getAttributeNodeNS...
- // but later levels also have Attr.getOwnerElement.
- Attr check=elem.getAttributeNode(attr.getNodeName());
- if(check==attr)
- parent = elem;
-
- if (null == parent)
- {
- for (Node node = elem.getFirstChild(); null != node;
- node = node.getNextSibling())
- {
- if (Node.ELEMENT_NODE == node.getNodeType())
- {
- parent = locateAttrParent((Element) node, attr);
-
- if (null != parent)
- break;
- }
- }
- }
-
- return parent;
- }
-
- /**
- * The factory object used for creating nodes
- * in the result tree.
- */
- protected Document m_DOMFactory = null;
-
- /**
- * Store the factory object required to create DOM nodes
- * in the result tree. In fact, that's just the result tree's
- * Document node...
- *
- * @param domFactory The DOM Document Node within whose context
- * the result tree will be built.
- */
- public void setDOMFactory(Document domFactory)
- {
- this.m_DOMFactory = domFactory;
- }
-
- /**
- * Retrieve the factory object required to create DOM nodes
- * in the result tree.
- *
- * @return The result tree's DOM Document Node.
- */
- public Document getDOMFactory()
- {
-
- if (null == this.m_DOMFactory)
- {
- this.m_DOMFactory = createDocument();
- }
-
- return this.m_DOMFactory;
- }
-
- /**
- * Get the textual contents of the node. See
- * getNodeData(Node,FastStringBuffer) for discussion of how
- * whitespace nodes are handled.
- *
- * @param node DOM Node to be examined
- * @return String containing a concatenation of all the
- * textual content within that node.
- * @see #getNodeData(Node,FastStringBuffer)
- *
- */
- public static String getNodeData(Node node)
- {
-
- FastStringBuffer buf = StringBufferPool.get();
- String s;
-
- try
- {
- getNodeData(node, buf);
-
- s = (buf.length() > 0) ? buf.toString() : "";
- }
- finally
- {
- StringBufferPool.free(buf);
- }
-
- return s;
- }
-
- /**
- * Retrieve the text content of a DOM subtree, appending it into a
- * user-supplied FastStringBuffer object. Note that attributes are
- * not considered part of the content of an element.
- *
- * There are open questions regarding whitespace stripping.
- * Currently we make no special effort in that regard, since the standard
- * DOM doesn't yet provide DTD-based information to distinguish
- * whitespace-in-element-context from genuine #PCDATA. Note that we
- * should probably also consider xml:space if/when we address this.
- * DOM Level 3 may solve the problem for us.
- *
- * @param node Node whose subtree is to be walked, gathering the
- * contents of all Text or CDATASection nodes.
- * @param buf FastStringBuffer into which the contents of the text
- * nodes are to be concatenated.
- */
- public static void getNodeData(Node node, FastStringBuffer buf)
- {
-
- switch (node.getNodeType())
- {
- case Node.DOCUMENT_FRAGMENT_NODE :
- case Node.DOCUMENT_NODE :
- case Node.ELEMENT_NODE :
- {
- for (Node child = node.getFirstChild(); null != child;
- child = child.getNextSibling())
- {
- getNodeData(child, buf);
- }
- }
- break;
- case Node.TEXT_NODE :
- case Node.CDATA_SECTION_NODE :
- buf.append(node.getNodeValue());
- break;
- case Node.ATTRIBUTE_NODE :
- buf.append(node.getNodeValue());
- break;
- case Node.PROCESSING_INSTRUCTION_NODE :
- // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
- break;
- default :
- // ignore
- break;
- }
- }
-}
diff -r 67a7eb693074 -r dc68478b53b9 jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMOrder.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/utils/DOMOrder.java Wed Jun 14 20:02:36 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.utils;
-
-/**
- * @deprecated Since the introduction of the DTM, this class will be removed.
- * Nodes that implement this index can return a document order index.
- * Eventually, this will be replaced by DOM 3 methods.
- * (compareDocumentOrder and/or compareTreePosition.)
- */
-public interface DOMOrder
-{
-
- /**
- * Get the UID (document order index).
- *
- * @return integer whose relative value corresponds to document order
- * -- that is, if node1.getUid()