aboutsummaryrefslogtreecommitdiff
path: root/src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java')
-rw-r--r--src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java90
1 files changed, 34 insertions, 56 deletions
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java b/src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java
index f74418a..77c56e5 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java
@@ -1,13 +1,13 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
*/
/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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
+ * 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
*
@@ -23,40 +23,35 @@
package com.sun.org.apache.xalan.internal.xsltc.dom;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.Enumeration;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-
import com.sun.org.apache.xalan.internal.xsltc.DOM;
import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM;
import com.sun.org.apache.xalan.internal.xsltc.StripFilter;
import com.sun.org.apache.xalan.internal.xsltc.TransletException;
import com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary;
-import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
-import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xml.internal.dtm.Axis;
+import com.sun.org.apache.xml.internal.dtm.DTM;
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
import com.sun.org.apache.xml.internal.dtm.DTMManager;
import com.sun.org.apache.xml.internal.dtm.DTMWSFilter;
import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIterNodeList;
import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
-import com.sun.org.apache.xml.internal.dtm.ref.EmptyIterator;
import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy;
+import com.sun.org.apache.xml.internal.dtm.ref.EmptyIterator;
import com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM2;
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
import com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler;
-import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
-import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Entity;
-
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -119,7 +114,7 @@ public final class SAXImpl extends SAX2DTM2
private int _namesSize = -1;
// Namespace related stuff
- private Hashtable _nsIndex = new Hashtable();
+ private Map<Integer, Integer> _nsIndex = new HashMap<>();
// The initial size of the text buffer
private int _size = 0;
@@ -134,10 +129,10 @@ public final class SAXImpl extends SAX2DTM2
// The owner Document when the input source is DOMSource.
private Document _document;
- // The hashtable for org.w3c.dom.Node to node id mapping.
+ // The Map for org.w3c.dom.Node to node id mapping.
// This is only used when the input is a DOMSource and the
// buildIdIndex flag is true.
- private Hashtable _node2Ids = null;
+ private Map<Node, Integer> _node2Ids = null;
// True if the input source is a DOMSource.
private boolean _hasDOMSource = false;
@@ -480,7 +475,7 @@ public final class SAXImpl extends SAX2DTM2
return 0;
}
int eType = getIdForNamespace(s);
- return ((Integer)_nsIndex.get(new Integer(eType))).intValue();
+ return _nsIndex.get(new Integer(eType));
}
@@ -679,9 +674,9 @@ public final class SAXImpl extends SAX2DTM2
for (i=0; i<nsLength; i++) {
int eType = getIdForNamespace(namespaces[i]);
- Integer type = (Integer)_nsIndex.get(new Integer(eType));
+ Integer type = _nsIndex.get(eType);
if (type != null) {
- result[type.intValue()] = (short)i;
+ result[type] = (short)i;
}
}
@@ -699,7 +694,7 @@ public final class SAXImpl extends SAX2DTM2
for (i = 0; i < length; i++) {
int eType = getIdForNamespace(namespaces[i]);
- Integer type = (Integer)_nsIndex.get(new Integer(eType));
+ Integer type = _nsIndex.get(eType);
result[i] = (type == null) ? -1 : type.shortValue();
}
@@ -752,7 +747,7 @@ public final class SAXImpl extends SAX2DTM2
else {
_document = node.getOwnerDocument();
}
- _node2Ids = new Hashtable();
+ _node2Ids = new HashMap<>();
}
}
@@ -780,8 +775,8 @@ public final class SAXImpl extends SAX2DTM2
{
Node node = _document.getElementById(idString);
if (node != null) {
- Integer id = (Integer)_node2Ids.get(node);
- return (id != null) ? id.intValue() : DTM.NULL;
+ Integer id = _node2Ids.get(node);
+ return (id != null) ? id : DTM.NULL;
}
else {
return DTM.NULL;
@@ -880,7 +875,7 @@ public final class SAXImpl extends SAX2DTM2
{
super.startDocument();
- _nsIndex.put(new Integer(0), new Integer(_uriCount++));
+ _nsIndex.put(0, _uriCount++);
definePrefixAndUri(XML_PREFIX, XML_URI);
}
@@ -987,8 +982,8 @@ public final class SAXImpl extends SAX2DTM2
{
// Check if the URI already exists before pushing on stack
Integer eType = new Integer(getIdForNamespace(uri));
- if ((Integer)_nsIndex.get(eType) == null) {
- _nsIndex.put(eType, new Integer(_uriCount++));
+ if (_nsIndex.get(eType) == null) {
+ _nsIndex.put(eType, _uriCount++);
}
}
@@ -1840,28 +1835,11 @@ public final class SAXImpl extends SAX2DTM2
}
/**
- * %HZ% Need Javadoc
+ * Return the attributes map.
+ * @return the attributes map.
*/
- public Hashtable getElementsWithIDs() {
- if (m_idAttributes == null) {
- return null;
- }
-
- // Convert a java.util.Hashtable to an xsltc.runtime.Hashtable
- Enumeration idValues = m_idAttributes.keys();
- if (!idValues.hasMoreElements()) {
- return null;
- }
-
- Hashtable idAttrsTable = new Hashtable();
-
- while (idValues.hasMoreElements()) {
- Object idValue = idValues.nextElement();
-
- idAttrsTable.put(idValue, m_idAttributes.get(idValue));
- }
-
- return idAttrsTable;
+ public Map<String, Integer> getElementsWithIDs() {
+ return m_idAttributes;
}
/**