8181153: Fix lint warnings in JAXP repo: dep-ann

Reviewed-by: lancea
This commit is contained in:
Joe Wang 2017-06-14 14:12:02 -07:00
parent d801a7d2ff
commit 30f0e4e6ad
58 changed files with 486 additions and 2512 deletions

@ -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 @@ public abstract class ReferenceType extends Type {
* @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;

@ -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 @@ public class ExsltSets extends ExsltBase
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 @@ public class ExsltSets extends ExsltBase
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;

@ -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 @@ public class XSLTErrorResources extends ListResourceBundle
/** 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 ";
}

@ -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 @@ public class XSLTErrorResources_de extends ListResourceBundle
/** 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 ";
}
}

@ -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 @@ public class XSLTErrorResources_es extends ListResourceBundle
/** 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 ";
}

@ -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 @@ public class XSLTErrorResources_fr extends ListResourceBundle
/** 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 ";
}
}

@ -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 @@ public class XSLTErrorResources_it extends ListResourceBundle
/** 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 ";
}
}

@ -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 @@ public class XSLTErrorResources_ja extends ListResourceBundle
/** 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 ";
}
}

@ -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 @@ public class XSLTErrorResources_ko extends ListResourceBundle
"\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 @@ public class XSLTErrorResources_ko extends ListResourceBundle
"\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 @@ public class XSLTErrorResources_ko extends ListResourceBundle
{ "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 @@ public class XSLTErrorResources_ko extends ListResourceBundle
{ "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 @@ public class XSLTErrorResources_ko extends ListResourceBundle
/** 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 ";
}
}

@ -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 @@ public class XSLTErrorResources_pt_BR extends ListResourceBundle
/** 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 ";
}
}

@ -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 @@ public class XSLTErrorResources_sv extends ListResourceBundle
{"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 @@ public class XSLTErrorResources_sv extends ListResourceBundle
/** 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 ";
}
}

@ -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 @@ public class XSLTErrorResources_zh_CN extends ListResourceBundle
/** 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 ";
}
}

@ -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 @@ public class XSLTErrorResources_zh_TW extends ListResourceBundle
/** 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 ";
}
}

@ -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 @@ import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase;
* @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;

@ -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 @@ public class KeyIndex extends DTMAxisIteratorBase {
* 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 @@ public class KeyIndex extends DTMAxisIteratorBase {
* key() function.
* @deprecated
*/
@Deprecated
public void lookupId(Object value) {
// Clear _nodes array
_nodes = null;
@ -205,6 +207,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public void lookupKey(Object value) {
IntegerArray nodes = _index.get(value);
_nodes = (nodes != null) ? (IntegerArray) nodes.clone() : null;
@ -217,6 +220,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public int next() {
if (_nodes == null) return DTMAxisIterator.END;
@ -313,6 +317,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public DTMAxisIterator reset() {
_position = 0;
return this;
@ -324,6 +329,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public int getLast() {
return (_nodes == null) ? 0 : _nodes.cardinality();
}
@ -334,6 +340,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public int getPosition() {
return _position;
}
@ -344,6 +351,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public void setMark() {
_markedPosition = _position;
}
@ -354,6 +362,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public void gotoMark() {
_position = _markedPosition;
}
@ -365,6 +374,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public DTMAxisIterator setStartNode(int start) {
if (start == DTMAxisIterator.END) {
_nodes = null;
@ -382,6 +392,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public int getStartNode() {
return 0;
}
@ -392,6 +403,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public boolean isReverse() {
return(false);
}
@ -402,6 +414,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
* <b>deprecated.</b></em></p>
* @deprecated
*/
@Deprecated
public DTMAxisIterator cloneIterator() {
KeyIndex other = new KeyIndex(0);
other._index = _index;

@ -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 @@ public abstract class NodeSortRecord {
* @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 @@ public abstract class NodeSortRecord {
* @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 @@ public abstract class NodeSortRecord {
* @deprecated This field continues to exist for binary compatibility.
* New code should not refer to it.
*/
@Deprecated
protected Locale _locale;
protected CollatorFactory _collatorFactory;

@ -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 @@ public class NodeSortRecordFactory {
* @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

@ -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 @@ public final class BasisLibrary {
* @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

@ -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 @@ public class AttrImpl
* @deprecated Previous working draft of DOM Level 2. New method
* is <tt>getOwnerElement()</tt>.
*/
@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

@ -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 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
@Deprecated
public void setEncoding(String value) {
setXmlEncoding(value);
}
@ -849,6 +850,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
@Deprecated
public String getEncoding() {
return getXmlEncoding();
}
@ -890,6 +892,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
@Deprecated
public void setVersion(String value) {
setXmlVersion(value);
}
@ -908,6 +911,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
@Deprecated
public String getVersion() {
return getXmlVersion();
}
@ -932,6 +936,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
@Deprecated
public void setStandalone(boolean value) {
setXmlStandalone(value);
}
@ -950,6 +955,7 @@ public class CoreDocumentImpl
* compatibility with older applications. New applications
* should never call this method.
*/
@Deprecated
public boolean getStandalone() {
return getXmlStandalone();
}

@ -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 @@ public class DeferredDocumentImpl
* 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 @@ public class DeferredDocumentImpl
* Creates an element node in the table.
* @deprecated
*/
@Deprecated
public int createDeferredElement(String elementName) {
return createDeferredElement(null, elementName);
}
@ -474,6 +476,7 @@ public class DeferredDocumentImpl
* Sets an attribute on an element node.
* @deprecated
*/
@Deprecated
public int setDeferredAttribute(int elementNodeIndex,
String attrName, String attrURI,
String attrValue, boolean specified) {

@ -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 @@ public abstract class NodeImpl
* @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

@ -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 @@ public interface ItemPSVI {
*
* @deprecated Use getSchemaValue().getNormalizedValue() instead
*/
@Deprecated
public String getSchemaNormalizedValue();
/**
@ -127,6 +127,7 @@ public interface ItemPSVI {
*
* @deprecated Use getSchemaValue().getActualValue() instead
*/
@Deprecated
public Object getActualNormalizedValue()
throws XSException;
@ -146,6 +147,7 @@ public interface ItemPSVI {
*
* @deprecated Use getSchemaValue().getActualValueType() instead
*/
@Deprecated
public short getActualNormalizedValueType()
throws XSException;
@ -182,6 +184,7 @@ public interface ItemPSVI {
*
* @deprecated Use getSchemaValue().getListValueTypes() instead
*/
@Deprecated
public ShortList getItemValueTypes()
throws XSException;

@ -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 @@ public interface XSAttributeDeclaration extends XSObject {
*
* @deprecated Use getValueConstraintValue().getNormalizedValue() instead
*/
@Deprecated
public String getConstraintValue();
/**
@ -67,6 +67,7 @@ public interface XSAttributeDeclaration extends XSObject {
*
* @deprecated Use getValueConstraintValue().getActualValue() instead
*/
@Deprecated
public Object getActualVC()
throws XSException;
@ -86,6 +87,7 @@ public interface XSAttributeDeclaration extends XSObject {
*
* @deprecated Use getValueConstraintValue().getActualValueType() instead
*/
@Deprecated
public short getActualVCType()
throws XSException;
@ -104,6 +106,7 @@ public interface XSAttributeDeclaration extends XSObject {
*
* @deprecated Use getValueConstraintValue().getListValueTypes() instead
*/
@Deprecated
public ShortList getItemValueTypes()
throws XSException;

@ -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 @@ public interface XSAttributeUse extends XSObject {
*
* @deprecated Use getValueConstraintValue().getNormalizedValue() instead
*/
@Deprecated
public String getConstraintValue();
/**
@ -60,6 +60,7 @@ public interface XSAttributeUse extends XSObject {
*
* @deprecated Use getValueConstraintValue().getActualValue() instead
*/
@Deprecated
public Object getActualVC()
throws XSException;
@ -79,6 +80,7 @@ public interface XSAttributeUse extends XSObject {
*
* @deprecated Use getValueConstraintValue().getActualValueType() instead
*/
@Deprecated
public short getActualVCType()
throws XSException;
@ -97,6 +99,7 @@ public interface XSAttributeUse extends XSObject {
*
* @deprecated Use getValueConstraintValue().getListValueTypes() instead
*/
@Deprecated
public ShortList getItemValueTypes()
throws XSException;

@ -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 @@ public interface XSElementDeclaration extends XSTerm {
*
* @deprecated Use getValueConstraintValue().getNormalizedValue() instead
*/
@Deprecated
public String getConstraintValue();
/**
@ -68,6 +68,7 @@ public interface XSElementDeclaration extends XSTerm {
*
* @deprecated Use getValueConstraintValue().getActualValue() instead
*/
@Deprecated
public Object getActualVC()
throws XSException;
@ -87,6 +88,7 @@ public interface XSElementDeclaration extends XSTerm {
*
* @deprecated Use getValueConstraintValue().getActualValueType() instead
*/
@Deprecated
public short getActualVCType()
throws XSException;
@ -105,6 +107,7 @@ public interface XSElementDeclaration extends XSTerm {
*
* @deprecated Use getValueConstraintValue().getListValueTypes() instead
*/
@Deprecated
public ShortList getItemValueTypes()
throws XSException;

@ -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 @@ import org.xml.sax.XMLReader;
* 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.

@ -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 @@ import org.xml.sax.ext.LexicalHandler;
* {@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

@ -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 @@ import org.w3c.dom.DocumentFragment;
* {@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
{

@ -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 @@ import org.w3c.dom.ls.LSSerializerFilter;
* @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

@ -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 @@ import java.util.Map;
* {@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
{

@ -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 @@ import java.nio.charset.CharsetEncoder;
* {@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;

@ -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 @@ import java.util.concurrent.ConcurrentHashMap;
* {@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
{

@ -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 @@ import org.xml.sax.SAXException;
* @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
* @see Serializer
*/
@Deprecated
public class HTMLSerializer
extends BaseMarkupSerializer
{

@ -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 @@ import java.util.Map;
* {@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
{

@ -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 @@ import java.io.IOException;
* {@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
{

@ -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 @@ package com.sun.org.apache.xml.internal.serialize;
* {@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
{

@ -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 @@ package com.sun.org.apache.xml.internal.serialize;
* {@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
{

@ -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 @@ import org.w3c.dom.Node;
* {@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
{

@ -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 @@ import java.io.IOException;
* {@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
{

@ -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 @@ import org.xml.sax.DocumentHandler;
* {@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
{

@ -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 @@ import java.util.StringTokenizer;
* {@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
{

@ -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 @@ import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter;
* {@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
{

@ -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 @@ import org.xml.sax.SAXException;
* {@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
{

@ -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 @@ import java.io.Writer;
* @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
* @see Serializer
*/
@Deprecated
public class XHTMLSerializer
extends HTMLSerializer
{

@ -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 @@ import org.xml.sax.SAXException;
* {@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 {

@ -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 @@ import org.xml.sax.helpers.AttributesImpl;
* {@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 {

@ -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.NamedNodeMap;
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 @@ public final class TreeWalker
*/
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 final class TreeWalker
}
public TreeWalker(ContentHandler ch) {
this(ch,null);
this(ch, null);
}
/**
* Constructor.
@ -99,8 +91,6 @@ public final class TreeWalker
if (systemId != null) {
m_locator.setSystemId(systemId);
}
m_dh = new DOM2Helper();
}
/**
@ -209,7 +199,7 @@ public final class TreeWalker
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 @@ public final class TreeWalker
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 @@ public final class TreeWalker
}
}
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 @@ public final class TreeWalker
{
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 @@ public final class TreeWalker
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

@ -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;
}
}

@ -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.
* <p>
* 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;
}

@ -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 @@ public class AttList implements Attributes
/** 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 @@ public class AttList implements Attributes
* @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 class AttList implements Attributes
*/
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 class AttList implements Attributes
*/
public String getLocalName(int index)
{
return m_dh.getLocalNameOfNode(((Attr) m_attrs.item(index)));
return DOM2Helper.getLocalNameOfNode(((Attr) m_attrs.item(index)));
}
/**

@ -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
{
public final class DOM2Helper {
/**
* Construct an instance.
*/
public 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());
}
/**
* 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;
/**
* 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;
}
/**
* 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;
}
/**
* Parse an XML document.
*
* <p>Right now the Xerces DOMParser class is used. This needs
* fixing, either via jaxp, or via some other, standard method.</p>
*
* <p>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).</p>
*
* <p>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.</p>
*
* @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
{
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);
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);
*/
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);
/**
* Construct an instance.
*/
private DOM2Helper() {
}
// setDocument(((com.sun.org.apache.xerces.internal.parsers.DOMParser)parser).getDocument());
}
/**
* 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) {
/**
* 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);
}
String name = n.getLocalName();
/**
* 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.
* <p>
* There are some cases where ordering isn't defined, and neither are
* the results of this function -- though we'll generally return true.
* <p>
* 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
* <code>(node1.documentOrderPosition &lt;= node2.documentOrderPosition)</code>.
*/
public static boolean isNodeAfter(Node node1, Node node2)
{
// 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();
return index1 <= index2;
return (null == name) ? getLocalNameOfNodeFallback(n) : name;
}
else
{
// isNodeAfter will return true if node is after countedNode
// in document order. The base isNodeAfter is sloooow (relatively).
return DOMHelper.isNodeAfter(node1, node2);
/**
* 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) {
String qname = n.getNodeName();
int index = qname.indexOf(':');
return (index < 0) ? qname : qname.substring(index + 1);
}
}
/**
* 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;
}
/**
* 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.
* <p>
* 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();
}
/**
* 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)
{
/**
* 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.
* <p>
* 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 &lt;= node2.documentOrderPosition)}.
*/
public static boolean isNodeAfter(Node node1, Node node2) {
if (node1 == node2 || isNodeTheSame(node1, node2)) {
return true;
}
String name = n.getLocalName();
// Default return value, if there is no defined ordering
boolean isNodeAfter = true;
return (null == name) ? super.getLocalNameOfNode(n) : name;
}
Node parent1 = getParentOfNode(node1);
Node parent2 = getParentOfNode(node2);
/**
* 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.
* <p>
* 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();
}
// 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
/** 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;
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)
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);
}
}
/**
* 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.
* <p>
* 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)) {
// 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)
}

@ -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()<node2.getUid(), node1 comes before
* node2, and if they're equal node1 and node2 are the same node. No
* promises are made beyond that.
*/
public int getUid();
}

@ -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,11 +17,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sun.org.apache.xml.internal.utils;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import java.io.File;
import com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler;
import javax.xml.transform.Result;
import org.w3c.dom.Comment;
import org.w3c.dom.Element;
import org.w3c.dom.EntityReference;
@ -47,14 +47,8 @@ public class TreeWalker
/** Local reference to a ContentHandler */
private ContentHandler m_contentHandler = null;
// ARGHH!! JAXP Uses Xerces without setting the namespace processing to ON!
// DOM2Helper m_dh = new DOM2Helper();
/** DomHelper for this TreeWalker */
protected DOMHelper m_dh;
/** Locator object for this TreeWalker */
private LocatorImpl m_locator = new LocatorImpl();
/** Locator object for this TreeWalker */
private LocatorImpl m_locator = new LocatorImpl();
/**
* Get the ContentHandler used for the tree walk.
@ -76,32 +70,21 @@ public class TreeWalker
m_contentHandler = ch;
}
/**
/**
* Constructor.
* @param contentHandler The implementation of the
* @param systemId System identifier for the document.
* contentHandler operation (toXMLString, digest, ...)
*/
public TreeWalker(ContentHandler contentHandler, DOMHelper dh, String systemId)
public TreeWalker(ContentHandler contentHandler, String systemId)
{
this.m_contentHandler = contentHandler;
m_contentHandler.setDocumentLocator(m_locator);
if (m_contentHandler != null) {
m_contentHandler.setDocumentLocator(m_locator);
}
if (systemId != null) {
m_locator.setSystemId(systemId);
}
m_dh = dh;
}
/**
* Constructor.
* @param contentHandler The implementation of the
* contentHandler operation (toXMLString, digest, ...)
*/
public TreeWalker(ContentHandler contentHandler, DOMHelper dh)
{
this.m_contentHandler = contentHandler;
m_contentHandler.setDocumentLocator(m_locator);
m_dh = dh;
}
/**
@ -111,11 +94,7 @@ public class TreeWalker
*/
public TreeWalker(ContentHandler contentHandler)
{
this.m_contentHandler = contentHandler;
if (m_contentHandler != null) {
m_contentHandler.setDocumentLocator(m_locator);
}
m_dh = new DOM2Helper();
this(contentHandler, null);
}
/**
@ -239,7 +218,7 @@ public class TreeWalker
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;
/**
@ -248,9 +227,9 @@ public class TreeWalker
private final void dispatachChars(Node node)
throws org.xml.sax.SAXException
{
if(m_contentHandler instanceof com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler)
if(m_contentHandler instanceof CharacterNodeHandler)
{
((com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler)m_contentHandler).characters(node);
((CharacterNodeHandler)m_contentHandler).characters(node);
}
else
{
@ -313,17 +292,14 @@ public class TreeWalker
case Node.ELEMENT_NODE :
NamedNodeMap atts = ((Element) node).getAttributes();
int nAttrs = atts.getLength();
// System.out.println("TreeWalker#startNode: "+node.getNodeName());
for (int i = 0; i < nAttrs; i++)
{
Node attr = atts.item(i);
String attrName = attr.getNodeName();
// System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue());
if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
{
// System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue());
int index;
// Use "" instead of null, as Xerces likes "" for the
// name of the default namespace. Fix attributed
@ -337,15 +313,13 @@ public class TreeWalker
}
// System.out.println("m_dh.getNamespaceOfNode(node): "+m_dh.getNamespaceOfNode(node));
// System.out.println("m_dh.getLocalNameOfNode(node): "+m_dh.getLocalNameOfNode(node));
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 :
{
@ -393,9 +367,9 @@ public class TreeWalker
{
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
{
@ -440,12 +414,12 @@ public class TreeWalker
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());
NamedNodeMap atts = ((Element) node).getAttributes();
int nAttrs = atts.getLength();

@ -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
@ -28,6 +27,7 @@ import com.sun.org.apache.xpath.internal.objects.XObject;
* The 'quo' operation expression executer. (no longer supported by XPath).
* @deprecated
*/
@Deprecated
public class Quo extends Operation
{
static final long serialVersionUID = 693765299196169905L;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -66,6 +66,7 @@ package org.xml.sax;
* @see org.xml.sax.DocumentHandler
* @see org.xml.sax.ErrorHandler
*/
@Deprecated(since="1.5")
public class HandlerBase
implements EntityResolver, DTDHandler, DocumentHandler, ErrorHandler
{

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -87,6 +87,7 @@ import java.util.Vector;
* @see org.xml.sax.AttributeList
* @see org.xml.sax.DocumentHandler#startElement
*/
@Deprecated(since="1.5")
public class AttributeListImpl implements AttributeList
{