/* */ package org.jaxen.dom;
/* */
/* */ import java.lang.reflect.
InvocationTargetException;
/* */ import java.lang.reflect.
Method;
/* */ import java.util.
HashMap;
/* */ import org.w3c.dom.
DOMException;
/* */ import org.w3c.dom.
Document;
/* */ import org.w3c.dom.
NamedNodeMap;
/* */ import org.w3c.dom.
Node;
/* */ import org.w3c.dom.
NodeList;
/* */ import org.w3c.dom.
UserDataHandler;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class
NamespaceNode
/* */ implements
Node
/* */ {
/* */ public static final short
NAMESPACE_NODE = 13;
/* */ private
Node parent;
/* */ private
String name;
/* */ private
String value;
/* */ private
HashMap userData;
/* */
/* */ public
NamespaceNode(
Node parent,
String name,
String value) {
/* 835 */ this.
userData = new
HashMap(); this.
parent =
parent; this.
name =
name; this.
value =
value; } public
String getNodeName() { return this.
name; } public
String getNodeValue() { return this.
value; } public void
setNodeValue(
String value) throws
DOMException {
disallowModification(); } public short
getNodeType() { return 13; } public
Node getParentNode() { return this.
parent; } public
NodeList getChildNodes() { return new
EmptyNodeList(); } public
Node getFirstChild() { return null; } public
Node getLastChild() { return null; } public
Node getPreviousSibling() { return null; } public
Node getNextSibling() { return null; }
NamespaceNode(
Node parent,
Node attribute) { this.
userData = new
HashMap();
String attributeName =
attribute.
getNodeName(); if (
attributeName.
equals("xmlns")) { this.
name = ""; }
/* */ else if (
attributeName.
startsWith("xmlns:")) { this.
name =
attributeName.
substring(6); }
/* */ else { this.
name =
attributeName; }
/* */ this.
parent =
parent; this.
value =
attribute.
getNodeValue(); }
/* */ public
NamedNodeMap getAttributes() { return null; }
/* */ public
Document getOwnerDocument() { if (this.
parent == null)
/* */ return null; return this.
parent.
getOwnerDocument(); }
/* */ public
Node insertBefore(
Node newChild,
Node refChild) throws
DOMException {
disallowModification(); return null; }
/* */ public
Node replaceChild(
Node newChild,
Node oldChild) throws
DOMException {
disallowModification(); return null; }
/* */ public
Node removeChild(
Node oldChild) throws
DOMException {
disallowModification(); return null; }
/* */ public
Node appendChild(
Node newChild) throws
DOMException {
disallowModification(); return null; }
/* */ public boolean
hasChildNodes() { return false; }
/* */ public
Node cloneNode(boolean
deep) { return new
NamespaceNode(this.
parent, this.
name, this.
value); }
/* 848 */ public void
normalize() {} public boolean
isSupported(
String feature,
String version) { return false; } public
Object setUserData(
String key,
Object data,
UserDataHandler handler) {
Object oldValue =
getUserData(
key);
/* 849 */ this.
userData.
put(
key,
data);
/* 850 */ return
oldValue; } public
String getNamespaceURI() { return null; }
/* */ public
String getPrefix() { return null; }
/* */ public void
setPrefix(
String prefix) throws
DOMException {
disallowModification(); }
/* */ public
String getLocalName() { return this.
name; }
/* */ public boolean
hasAttributes() { return false; }
/* */ private void
disallowModification() throws
DOMException { throw new
DOMException((short)7, "Namespace node may not be modified"); }
/* */ public int
hashCode() { return
hashCode(this.
parent) +
hashCode(this.
name) +
hashCode(this.
value); }
/* */ public boolean
equals(
Object o) { if (
o == this)
/* */ return true; if (
o == null)
/* */ return false; if (
o instanceof
NamespaceNode) {
NamespaceNode ns = (
NamespaceNode)
o; return (
equals(this.
parent,
ns.
getParentNode()) &&
equals(this.
name,
ns.
getNodeName()) &&
equals(this.
value,
ns.
getNodeValue())); } return false; }
/* */ private int
hashCode(
Object o) { return (
o == null) ? 0 :
o.
hashCode(); }
/* */ private boolean
equals(
Object a,
Object b) { return ((
a == null &&
b == null) || (
a != null &&
a.
equals(
b))); }
/* 862 */ public
Object getUserData(
String key) { return this.
userData.
get(
key); }
/* */
/* */
/* */ private static class
EmptyNodeList implements
NodeList {
/* */ private
EmptyNodeList() {}
/* */
/* */ public int
getLength() {
/* */ return 0;
/* */ }
/* */
/* */ public
Node item(int
index) {
/* */ return null;
/* */ }
/* */ }
/* */
/* */ public
String getBaseURI() {
/* */
Class clazz =
Node.class;
/* */ try {
/* */
Class[]
args = new
Class[0];
/* */
Method getBaseURI =
clazz.
getMethod("getBaseURI",
args);
/* */
String base = (
String)
getBaseURI.
invoke(
getParentNode(), (
Object[])
args);
/* */ return
base;
/* */ } catch (
Exception ex) {
/* */ return null;
/* */ }
/* */ }
/* */
/* */ public short
compareDocumentPosition(
Node other) throws
DOMException {
/* */
DOMException ex = new
DOMException((short)9, "DOM level 3 interfaces are not fully implemented in Jaxen's NamespaceNode class");
/* */ throw
ex;
/* */ }
/* */
/* */ public
String getTextContent() {
/* */ return this.
value;
/* */ }
/* */
/* */ public void
setTextContent(
String textContent) throws
DOMException {
/* */
disallowModification();
/* */ }
/* */
/* */ public boolean
isSameNode(
Node other) {
/* */ boolean
bool1,
a =
isEqualNode(
other);
/* */
Node thisParent =
getParentNode();
/* */
Node thatParent =
other.
getParentNode();
/* */ try {
/* */
Class clazz =
Node.class;
/* */
Class[]
args = {
clazz };
/* */
Method isEqual =
clazz.
getMethod("isEqual",
args);
/* */
Object[]
args2 = new
Object[1];
/* */
args2[0] =
thatParent;
/* */
Boolean result = (
Boolean)
isEqual.
invoke(
thisParent,
args2);
/* */
bool1 =
result.
booleanValue();
/* */ } catch (
NoSuchMethodException ex) {
/* */
bool1 =
thisParent.
equals(
thatParent);
/* */ } catch (
InvocationTargetException ex) {
/* */
bool1 =
thisParent.
equals(
thatParent);
/* */ } catch (
IllegalAccessException ex) {
/* */
bool1 =
thisParent.
equals(
thatParent);
/* */ }
/* */ return (
a &&
bool1);
/* */ }
/* */
/* */ public
String lookupPrefix(
String namespaceURI) {
/* */ try {
/* */
Class clazz =
Node.class;
/* */
Class[]
argTypes = {
String.class };
/* */
Method lookupPrefix =
clazz.
getMethod("lookupPrefix",
argTypes);
/* */
String[]
args = {
namespaceURI };
/* */
String result = (
String)
lookupPrefix.
invoke(this.
parent, (
Object[])
args);
/* */ return
result;
/* */ } catch (
NoSuchMethodException ex) {
/* */ throw new
UnsupportedOperationException("Cannot lookup prefixes in DOM 2");
/* */ } catch (
InvocationTargetException ex) {
/* */ throw new
UnsupportedOperationException("Cannot lookup prefixes in DOM 2");
/* */ } catch (
IllegalAccessException ex) {
/* */ throw new
UnsupportedOperationException("Cannot lookup prefixes in DOM 2");
/* */ }
/* */ }
/* */
/* */ public boolean
isDefaultNamespace(
String namespaceURI) {
/* */ return
namespaceURI.
equals(
lookupNamespaceURI(null));
/* */ }
/* */
/* */ public
String lookupNamespaceURI(
String prefix) {
/* */ try {
/* */
Class clazz =
Node.class;
/* */
Class[]
argTypes = {
String.class };
/* */
Method lookupNamespaceURI =
clazz.
getMethod("lookupNamespaceURI",
argTypes);
/* */
String[]
args = {
prefix };
/* */
String result = (
String)
lookupNamespaceURI.
invoke(this.
parent, (
Object[])
args);
/* */ return
result;
/* */ } catch (
NoSuchMethodException ex) {
/* */ throw new
UnsupportedOperationException("Cannot lookup namespace URIs in DOM 2");
/* */ } catch (
InvocationTargetException ex) {
/* */ throw new
UnsupportedOperationException("Cannot lookup namespace URIs in DOM 2");
/* */ } catch (
IllegalAccessException ex) {
/* */ throw new
UnsupportedOperationException("Cannot lookup namespace URIs in DOM 2");
/* */ }
/* */ }
/* */
/* */ public boolean
isEqualNode(
Node arg) {
/* */ if (
arg.
getNodeType() ==
getNodeType()) {
/* */
NamespaceNode other = (
NamespaceNode)
arg;
/* */ if (
other.
name == null && this.
name != null)
/* */ return false;
/* */ if (
other.
name != null && this.
name == null)
/* */ return false;
/* */ if (
other.
value == null && this.
value != null)
/* */ return false;
/* */ if (
other.
value != null && this.
value == null)
/* */ return false;
/* */ if (
other.
name == null && this.
name == null)
/* */ return
other.
value.
equals(this.
value);
/* */ return (
other.
name.
equals(this.
name) &&
other.
value.
equals(this.
value));
/* */ }
/* */ return false;
/* */ }
/* */
/* */ public
Object getFeature(
String feature,
String version) {
/* */ return null;
/* */ }
/* */ }
/* Location: /Users/tommy/.m2/repository/jaxen/jaxen/1.1.1/jaxen-1.1.1.jar!/org/jaxen/dom/NamespaceNode.class
* Java compiler version: 2 (46.0)
* JD-Core Version: 1.1.3
*/