jaxen-1.1-beta-8

16:37:16.513 INFO  jd.cli.Main - Decompiling jaxen-1.1-beta-8.jar
package org.jaxen;

import java.io.Serializable;
import java.util.List;
import org.jaxen.expr.Expr;
import org.jaxen.expr.XPathExpr;
import org.jaxen.function.BooleanFunction;
import org.jaxen.function.NumberFunction;
import org.jaxen.function.StringFunction;
import org.jaxen.saxpath.SAXPathException;
import org.jaxen.saxpath.XPathReader;
import org.jaxen.saxpath.helpers.XPathReaderFactory;
import org.jaxen.util.SingletonList;

public class BaseXPath
  implements XPath, Serializable
{
  private String exprText;
  private XPathExpr xpath;
  private ContextSupport support;
  private Navigator navigator;
  
  protected BaseXPath(String xpathExpr)
    throws JaxenException
  {
    try
    {
      XPathReader reader = XPathReaderFactory.createReader();
      JaxenHandler handler = new JaxenHandler();
      reader.setXPathHandler(handler);
      reader.parse(xpathExpr);
      xpath = handler.getXPathExpr();
    }
    catch (org.jaxen.saxpath.XPathSyntaxException e)
    {
      throw new XPathSyntaxException(e);
    }
    catch (SAXPathException e)
    {
      throw new JaxenException(e);
    }
    exprText = xpathExpr;
  }
  
  public BaseXPath(String xpathExpr, Navigator navigator)
    throws JaxenException
  {
    this(xpathExpr);
    this.navigator = navigator;
  }
  
  public Object evaluate(Object context)
    throws JaxenException
  {
    List answer = selectNodes(context);
    if ((answer != null) && (answer.size() == 1))
    {
      Object first = answer.get(0);
      if (((first instanceof String)) || ((first instanceof Number)) || ((first instanceof Boolean))) {
        return first;
      }
    }
    return answer;
  }
  
  public List selectNodes(Object node)
    throws JaxenException
  {
    Context context = getContext(node);
    return selectNodesForContext(context);
  }
  
  public Object selectSingleNode(Object node)
    throws JaxenException
  {
    List results = selectNodes(node);
    if (results.isEmpty()) {
      return null;
    }
    return results.get(0);
  }
  
  /**
   * @deprecated
   */
  public String valueOf(Object node)
    throws JaxenException
  {
    return stringValueOf(node);
  }
  
  public String stringValueOf(Object node)
    throws JaxenException
  {
    Context context = getContext(node);
    
    Object result = selectSingleNodeForContext(context);
    if (result == null) {
      return "";
    }
    return StringFunction.evaluate(result, context.getNavigator());
  }
  
  public boolean booleanValueOf(Object node)
    throws JaxenException
  {
    Context context = getContext(node);
    List result = selectNodesForContext(context);
    if (result == null) {
      return false;
    }
    return BooleanFunction.evaluate(result, context.getNavigator()).booleanValue();
  }
  
  public Number numberValueOf(Object node)
    throws JaxenException
  {
    Context context = getContext(node);
    Object result = selectSingleNodeForContext(context);
    return NumberFunction.evaluate(result, context.getNavigator());
  }
  
  public void addNamespace(String prefix, String uri)
    throws JaxenException
  {
    NamespaceContext nsContext = getNamespaceContext();
    if ((nsContext instanceof SimpleNamespaceContext))
    {
      ((SimpleNamespaceContext)nsContext).addNamespace(prefix, uri);
      
      return;
    }
    throw new JaxenException("Operation not permitted while using a non-simple namespace context.");
  }
  
  public void setNamespaceContext(NamespaceContext namespaceContext)
  {
    getContextSupport().setNamespaceContext(namespaceContext);
  }
  
  public void setFunctionContext(FunctionContext functionContext)
  {
    getContextSupport().setFunctionContext(functionContext);
  }
  
  public void setVariableContext(VariableContext variableContext)
  {
    getContextSupport().setVariableContext(variableContext);
  }
  
  public NamespaceContext getNamespaceContext()
  {
    return getContextSupport().getNamespaceContext();
  }
  
  public FunctionContext getFunctionContext()
  {
    return getContextSupport().getFunctionContext();
  }
  
  public VariableContext getVariableContext()
  {
    return getContextSupport().getVariableContext();
  }
  
  public Expr getRootExpr()
  {
    return xpath.getRootExpr();
  }
  
  public String toString()
  {
    return exprText;
  }
  
  public String debug()
  {
    return xpath.toString();
  }
  
  protected Context getContext(Object node)
  {
    if ((node instanceof Context)) {
      return (Context)node;
    }
    Context fullContext = new Context(getContextSupport());
    if ((node instanceof List))
    {
      fullContext.setNodeSet((List)node);
    }
    else
    {
      List list = new SingletonList(node);
      fullContext.setNodeSet(list);
    }
    return fullContext;
  }
  
  protected ContextSupport getContextSupport()
  {
    if (support == null) {
      support = new ContextSupport(createNamespaceContext(), createFunctionContext(), createVariableContext(), getNavigator());
    }
    return support;
  }
  
  public Navigator getNavigator()
  {
    return navigator;
  }
  
  protected FunctionContext createFunctionContext()
  {
    return XPathFunctionContext.getInstance();
  }
  
  protected NamespaceContext createNamespaceContext()
  {
    return new SimpleNamespaceContext();
  }
  
  protected VariableContext createVariableContext()
  {
    return new SimpleVariableContext();
  }
  
  protected List selectNodesForContext(Context context)
    throws JaxenException
  {
    List list = xpath.asList(context);
    return list;
  }
  
  protected Object selectSingleNodeForContext(Context context)
    throws JaxenException
  {
    List results = selectNodesForContext(context);
    if (results.isEmpty()) {
      return null;
    }
    return results.get(0);
  }
}

/* Location:
 * Qualified Name:     org.jaxen.BaseXPath
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Context
  implements Serializable
{
  private ContextSupport contextSupport;
  private List nodeSet;
  private int size;
  private int position;
  
  public Context(ContextSupport contextSupport)
  {
    this.contextSupport = contextSupport;
    nodeSet = Collections.EMPTY_LIST;
  }
  
  public void setNodeSet(List nodeSet)
  {
    this.nodeSet = nodeSet;
  }
  
  public List getNodeSet()
  {
    return nodeSet;
  }
  
  public void setContextSupport(ContextSupport contextSupport)
  {
    this.contextSupport = contextSupport;
  }
  
  public ContextSupport getContextSupport()
  {
    return contextSupport;
  }
  
  public Navigator getNavigator()
  {
    return getContextSupport().getNavigator();
  }
  
  public String translateNamespacePrefixToUri(String prefix)
  {
    return getContextSupport().translateNamespacePrefixToUri(prefix);
  }
  
  public Object getVariableValue(String namespaceURI, String prefix, String localName)
    throws UnresolvableException
  {
    return getContextSupport().getVariableValue(namespaceURI, prefix, localName);
  }
  
  public Function getFunction(String namespaceURI, String prefix, String localName)
    throws UnresolvableException
  {
    return getContextSupport().getFunction(namespaceURI, prefix, localName);
  }
  
  public void setSize(int size)
  {
    this.size = size;
  }
  
  public int getSize()
  {
    return size;
  }
  
  public void setPosition(int position)
  {
    this.position = position;
  }
  
  public int getPosition()
  {
    return position;
  }
  
  public Context duplicate()
  {
    Context dupe = new Context(getContextSupport());
    
    List thisNodeSet = getNodeSet();
    if (thisNodeSet != null)
    {
      List dupeNodeSet = new ArrayList(thisNodeSet.size());
      dupeNodeSet.addAll(thisNodeSet);
      dupe.setNodeSet(dupeNodeSet);
    }
    return dupe;
  }
}

/* Location:
 * Qualified Name:     org.jaxen.Context
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen;

import java.io.Serializable;

public class ContextSupport
  implements Serializable
{
  private transient FunctionContext functionContext;
  private NamespaceContext namespaceContext;
  private VariableContext variableContext;
  private Navigator navigator;
  
  public ContextSupport() {}
  
  public ContextSupport(NamespaceContext namespaceContext, FunctionContext functionContext, VariableContext variableContext, Navigator navigator)
  {
    setNamespaceContext(namespaceContext);
    setFunctionContext(functionContext);
    setVariableContext(variableContext);
    
    this.navigator = navigator;
  }
  
  public void setNamespaceContext(NamespaceContext namespaceContext)
  {
    this.namespaceContext = namespaceContext;
  }
  
  public NamespaceContext getNamespaceContext()
  {
    return namespaceContext;
  }
  
  public void setFunctionContext(FunctionContext functionContext)
  {
    this.functionContext = functionContext;
  }
  
  public FunctionContext getFunctionContext()
  {
    return functionContext;
  }
  
  public void setVariableContext(VariableContext variableContext)
  {
    this.variableContext = variableContext;
  }
  
  public VariableContext getVariableContext()
  {
    return variableContext;
  }
  
  public Navigator getNavigator()
  {
    return navigator;
  }
  
  public String translateNamespacePrefixToUri(String prefix)
  {
    if ("xml".equals(prefix)) {
      return "http://www.w3.org/XML/1998/namespace";
    }
    NamespaceContext context = getNamespaceContext();
    if (context != null) {
      return context.translateNamespacePrefixToUri(prefix);
    }
    return null;
  }
  
  public Object getVariableValue(String namespaceURI, String prefix, String localName)
    throws UnresolvableException
  {
    VariableContext context = getVariableContext();
    if (context != null) {
      return context.getVariableValue(namespaceURI, prefix, localName);
    }
    throw new UnresolvableException("No variable context installed");
  }
  
  public Function getFunction(String namespaceURI, String prefix, String localName)
    throws UnresolvableException
  {
    FunctionContext context = getFunctionContext();
    if (context != null) {
      return context.getFunction(namespaceURI, prefix, localName);
    }
    throw new UnresolvableException("No function context installed");
  }
}

/* Location:
 * Qualified Name:     org.jaxen.ContextSupport
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen;

import java.util.Iterator;
import org.jaxen.util.AncestorAxisIterator;
import org.jaxen.util.AncestorOrSelfAxisIterator;
import org.jaxen.util.DescendantAxisIterator;
import org.jaxen.util.DescendantOrSelfAxisIterator;
import org.jaxen.util.FollowingAxisIterator;
import org.jaxen.util.FollowingSiblingAxisIterator;
import org.jaxen.util.PrecedingAxisIterator;
import org.jaxen.util.PrecedingSiblingAxisIterator;
import org.jaxen.util.SelfAxisIterator;

public abstract class DefaultNavigator
  implements Navigator
{
  public Iterator getChildAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    throw new UnsupportedAxisException("child");
  }
  
  public Iterator getDescendantAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    return new DescendantAxisIterator(contextNode, this);
  }
  
  public Iterator getParentAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    throw new UnsupportedAxisException("parent");
  }
  
  public Iterator getAncestorAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    return new AncestorAxisIterator(contextNode, this);
  }
  
  public Iterator getFollowingSiblingAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    return new FollowingSiblingAxisIterator(contextNode, this);
  }
  
  public Iterator getPrecedingSiblingAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    return new PrecedingSiblingAxisIterator(contextNode, this);
  }
  
  public Iterator getFollowingAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    return new FollowingAxisIterator(contextNode, this);
  }
  
  public Iterator getPrecedingAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    return new PrecedingAxisIterator(contextNode, this);
  }
  
  public Iterator getAttributeAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    throw new UnsupportedAxisException("attribute");
  }
  
  public Iterator getNamespaceAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    throw new UnsupportedAxisException("namespace");
  }
  
  public Iterator getSelfAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    return new SelfAxisIterator(contextNode);
  }
  
  public Iterator getDescendantOrSelfAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    return new DescendantOrSelfAxisIterator(contextNode, this);
  }
  
  public Iterator getAncestorOrSelfAxisIterator(Object contextNode)
    throws UnsupportedAxisException
  {
    return new AncestorOrSelfAxisIterator(contextNode, this);
  }
  
  public Object getDocumentNode(Object contextNode)
  {
    return null;
  }
  
  public String translateNamespacePrefixToUri(String prefix, Object element)
  {
    return null;
  }
  
  public String getProcessingInstructionTarget(Object obj)
  {
    return null;
  }
  
  public String getProcessingInstructionData(Object obj)
  {
    return null;
  }
  
  public short getNodeType(Object node)
  {
    if (isElement(node)) {
      return 1;
    }
    if (isAttribute(node)) {
      return 2;
    }
    if (isText(node)) {
      return 3;
    }
    if (isComment(node)) {
      return 8;
    }
    if (isDocument(node)) {
      return 9;
    }
    if (isProcessingInstruction(node)) {
      return 7;
    }
    if (isNamespace(node)) {
      return 13;
    }
    return 14;
  }
  
  public Object getParentNode(Object contextNode)
    throws UnsupportedAxisException
  {
    Iterator iter = getParentAxisIterator(contextNode);
    if ((iter != null) && (iter.hasNext())) {
      return iter.next();
    }
    return null;
  }
  
  public Object getDocument(String url)
    throws FunctionCallException
  {
    return null;
  }
  
  public Object getElementById(Object contextNode, String elementId)
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.jaxen.DefaultNavigator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

import org.w3c.dom.Node;

class DocumentNavigator$1
  extends DocumentNavigator.NodeIterator
{
  private final DocumentNavigator this$0;
  
  protected Node getFirstNode(Node node)
  {
    return node.getFirstChild();
  }
  
  DocumentNavigator$1(DocumentNavigator this$0, Node x0)
  {
    super(this$0, x0);this.this$0 = this$0;
  }
  
  protected Node getNextNode(Node node)
  {
    return node.getNextSibling();
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom.DocumentNavigator.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

import org.w3c.dom.Attr;
import org.w3c.dom.Node;

class DocumentNavigator$2
  extends DocumentNavigator.NodeIterator
{
  private final DocumentNavigator this$0;
  
  protected Node getFirstNode(Node n)
  {
    return ((Attr)n).getOwnerElement();
  }
  
  DocumentNavigator$2(DocumentNavigator this$0, Node x0)
  {
    super(this$0, x0);this.this$0 = this$0;
  }
  
  protected Node getNextNode(Node n)
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom.DocumentNavigator.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

import org.w3c.dom.Node;

class DocumentNavigator$3
  extends DocumentNavigator.NodeIterator
{
  private final DocumentNavigator this$0;
  
  protected Node getFirstNode(Node n)
  {
    return n.getParentNode();
  }
  
  DocumentNavigator$3(DocumentNavigator this$0, Node x0)
  {
    super(this$0, x0);this.this$0 = this$0;
  }
  
  protected Node getNextNode(Node n)
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom.DocumentNavigator.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

import org.w3c.dom.Node;

class DocumentNavigator$4
  extends DocumentNavigator.NodeIterator
{
  private final DocumentNavigator this$0;
  
  protected Node getFirstNode(Node node)
  {
    return getNextNode(node);
  }
  
  DocumentNavigator$4(DocumentNavigator this$0, Node x0)
  {
    super(this$0, x0);this.this$0 = this$0;
  }
  
  protected Node getNextNode(Node node)
  {
    return node.getNextSibling();
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom.DocumentNavigator.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

import org.w3c.dom.Node;

class DocumentNavigator$5
  extends DocumentNavigator.NodeIterator
{
  private final DocumentNavigator this$0;
  
  protected Node getFirstNode(Node node)
  {
    return getNextNode(node);
  }
  
  DocumentNavigator$5(DocumentNavigator this$0, Node x0)
  {
    super(this$0, x0);this.this$0 = this$0;
  }
  
  protected Node getNextNode(Node node)
  {
    return node.getPreviousSibling();
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom.DocumentNavigator.5
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

import org.w3c.dom.Node;

class DocumentNavigator$6
  extends DocumentNavigator.NodeIterator
{
  private final DocumentNavigator this$0;
  
  protected Node getFirstNode(Node node)
  {
    if (node == null) {
      return null;
    }
    Node sibling = node.getNextSibling();
    if (sibling == null) {
      return getFirstNode(node.getParentNode());
    }
    return sibling;
  }
  
  DocumentNavigator$6(DocumentNavigator this$0, Node x0)
  {
    super(this$0, x0);this.this$0 = this$0;
  }
  
  protected Node getNextNode(Node node)
  {
    if (node == null) {
      return null;
    }
    Node n = node.getFirstChild();
    if (n == null) {
      n = node.getNextSibling();
    }
    if (n == null) {
      return getFirstNode(node.getParentNode());
    }
    return n;
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom.DocumentNavigator.6
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

import java.util.Iterator;
import java.util.NoSuchElementException;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

class DocumentNavigator$AttributeIterator
  implements Iterator
{
  private NamedNodeMap map;
  private int pos;
  
  DocumentNavigator$AttributeIterator(Node parent)
  {
    map = parent.getAttributes();
    pos = 0;
    for (int i = map.getLength() - 1; i >= 0; i--)
    {
      Node node = map.item(i);
      if (!"http://www.w3.org/2000/xmlns/".equals(node.getNamespaceURI()))
      {
        lastAttribute = i;
        break;
      }
    }
  }
  
  public boolean hasNext()
  {
    return pos <= lastAttribute;
  }
  
  public Object next()
  {
    Node attr = map.item(pos++);
    if (attr == null) {
      throw new NoSuchElementException();
    }
    if ("http://www.w3.org/2000/xmlns/".equals(attr.getNamespaceURI())) {
      return next();
    }
    return attr;
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException();
  }
  
  private int lastAttribute = -1;
}

/* Location:
 * Qualified Name:     org.jaxen.dom.DocumentNavigator.AttributeIterator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

import java.util.Iterator;
import java.util.NoSuchElementException;
import org.w3c.dom.Node;

abstract class DocumentNavigator$NodeIterator
  implements Iterator
{
  private Node node;
  private final DocumentNavigator this$0;
  
  public DocumentNavigator$NodeIterator(DocumentNavigator this$0, Node contextNode)
  {
    this.this$0 = this$0;
    node = getFirstNode(contextNode);
    while (!isXPathNode(node)) {
      node = getNextNode(node);
    }
  }
  
  public boolean hasNext()
  {
    return node != null;
  }
  
  public Object next()
  {
    if (node == null) {
      throw new NoSuchElementException();
    }
    Node ret = node;
    node = getNextNode(node);
    while (!isXPathNode(node)) {
      node = getNextNode(node);
    }
    return ret;
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException();
  }
  
  protected abstract Node getFirstNode(Node paramNode);
  
  protected abstract Node getNextNode(Node paramNode);
  
  private boolean isXPathNode(Node node)
  {
    if (node == null) {
      return true;
    }
    switch (node.getNodeType())
    {
    case 5: 
    case 6: 
    case 10: 
    case 11: 
    case 12: 
      return false;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom.DocumentNavigator.NodeIterator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
null
package org.jaxen.dom;

import org.jaxen.BaseXPath;
import org.jaxen.JaxenException;

public class DOMXPath
  extends BaseXPath
{
  public DOMXPath(String xpathExpr)
    throws JaxenException
  {
    super(xpathExpr, DocumentNavigator.getInstance());
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom.DOMXPath
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

class NamespaceNode$1 {}

/* Location:
 * Qualified Name:     org.jaxen.dom.NamespaceNode.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

class NamespaceNode$EmptyNodeList
  implements NodeList
{
  NamespaceNode$EmptyNodeList(NamespaceNode.1 x0)
  {
    this();
  }
  
  public int getLength()
  {
    return 0;
  }
  
  public Node item(int index)
  {
    return null;
  }
  
  private NamespaceNode$EmptyNodeList() {}
}

/* Location:
 * Qualified Name:     org.jaxen.dom.NamespaceNode.EmptyNodeList
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom;

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;
  
  public NamespaceNode(Node parent, String name, String value)
  {
    this.parent = parent;
    this.name = name;
    this.value = value;
  }
  
  NamespaceNode(Node parent, Node attribute)
  {
    String attributeName = attribute.getNodeName();
    if (attributeName.equals("xmlns")) {
      name = "";
    } else if (attributeName.startsWith("xmlns:")) {
      name = attributeName.substring(6);
    } else {
      name = attributeName;
    }
    this.parent = parent;
    value = attribute.getNodeValue();
  }
  
  public String getNodeName()
  {
    return name;
  }
  
  public String getNodeValue()
  {
    return value;
  }
  
  public void setNodeValue(String value)
    throws DOMException
  {
    disallowModification();
  }
  
  public short getNodeType()
  {
    return 13;
  }
  
  public Node getParentNode()
  {
    return parent;
  }
  
  public NodeList getChildNodes()
  {
    return new EmptyNodeList(null);
  }
  
  public Node getFirstChild()
  {
    return null;
  }
  
  public Node getLastChild()
  {
    return null;
  }
  
  public Node getPreviousSibling()
  {
    return null;
  }
  
  public Node getNextSibling()
  {
    return null;
  }
  
  public NamedNodeMap getAttributes()
  {
    return null;
  }
  
  public Document getOwnerDocument()
  {
    if (parent == null) {
      return null;
    }
    return 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(parent, name, value);
  }
  
  public void normalize() {}
  
  public boolean isSupported(String feature, String version)
  {
    return false;
  }
  
  public String getNamespaceURI()
  {
    return null;
  }
  
  public String getPrefix()
  {
    return null;
  }
  
  public void setPrefix(String prefix)
    throws DOMException
  {
    disallowModification();
  }
  
  public String getLocalName()
  {
    return 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(parent) + hashCode(name) + hashCode(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(parent, ns.getParentNode())) && (equals(name, ns.getNodeName())) && (equals(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)));
  }
  
  private static class EmptyNodeList
    implements NodeList
  {
    EmptyNodeList(NamespaceNode.1 x0)
    {
      this();
    }
    
    public int getLength()
    {
      return 0;
    }
    
    public Node item(int index)
    {
      return null;
    }
    
    private EmptyNodeList() {}
  }
  
  public String getBaseURI()
  {
    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 value;
  }
  
  public void setTextContent(String textContent)
    throws DOMException
  {
    disallowModification();
  }
  
  public boolean isSameNode(Node other)
  {
    return (isEqualNode(other)) && (getParentNode() == other.getParentNode());
  }
  
  public String lookupPrefix(String namespaceURI)
  {
    throw new UnsupportedOperationException("Changing interfaces in a JDK blows chunks!");
  }
  
  public boolean isDefaultNamespace(String namespaceURI)
  {
    return namespaceURI.equals(lookupNamespaceURI(null));
  }
  
  public String lookupNamespaceURI(String prefix)
  {
    throw new UnsupportedOperationException("Changing interfaces in a JDK blows chunks!");
  }
  
  public boolean isEqualNode(Node arg)
  {
    if (arg.getNodeType() == getNodeType())
    {
      NamespaceNode other = (NamespaceNode)arg;
      if ((name == null) && (name != null)) {
        return false;
      }
      if ((name != null) && (name == null)) {
        return false;
      }
      if ((value == null) && (value != null)) {
        return false;
      }
      if ((value != null) && (value == null)) {
        return false;
      }
      if ((name == null) && (name == null)) {
        return value.equals(value);
      }
      return (name.equals(name)) && (value.equals(value));
    }
    return false;
  }
  
  public Object getFeature(String feature, String version)
  {
    return null;
  }
  
  private HashMap userData = new HashMap();
  
  public Object setUserData(String key, Object data, UserDataHandler handler)
  {
    Object oldValue = getUserData(key);
    userData.put(key, data);
    return oldValue;
  }
  
  public Object getUserData(String key)
  {
    return userData.get(key);
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom.NamespaceNode
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom4j;

class DocumentNavigator$Singleton
{
  private static DocumentNavigator instance = new DocumentNavigator();
}

/* Location:
 * Qualified Name:     org.jaxen.dom4j.DocumentNavigator.Singleton
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom4j;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.dom4j.Attribute;
import org.dom4j.Branch;
import org.dom4j.CDATA;
import org.dom4j.Comment;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.Namespace;
import org.dom4j.Node;
import org.dom4j.ProcessingInstruction;
import org.dom4j.QName;
import org.dom4j.Text;
import org.dom4j.io.SAXReader;
import org.jaxen.DefaultNavigator;
import org.jaxen.FunctionCallException;
import org.jaxen.JaxenConstants;
import org.jaxen.NamedAccessNavigator;
import org.jaxen.Navigator;
import org.jaxen.XPath;
import org.jaxen.saxpath.SAXPathException;
import org.jaxen.util.SingleObjectIterator;

public class DocumentNavigator
  extends DefaultNavigator
  implements NamedAccessNavigator
{
  private transient SAXReader reader;
  
  private static class Singleton
  {
    private static DocumentNavigator instance = new DocumentNavigator();
  }
  
  public static Navigator getInstance()
  {
    return Singleton.instance;
  }
  
  public boolean isElement(Object obj)
  {
    return obj instanceof Element;
  }
  
  public boolean isComment(Object obj)
  {
    return obj instanceof Comment;
  }
  
  public boolean isText(Object obj)
  {
    return ((obj instanceof Text)) || ((obj instanceof CDATA));
  }
  
  public boolean isAttribute(Object obj)
  {
    return obj instanceof Attribute;
  }
  
  public boolean isProcessingInstruction(Object obj)
  {
    return obj instanceof ProcessingInstruction;
  }
  
  public boolean isDocument(Object obj)
  {
    return obj instanceof Document;
  }
  
  public boolean isNamespace(Object obj)
  {
    return obj instanceof Namespace;
  }
  
  public String getElementName(Object obj)
  {
    Element elem = (Element)obj;
    
    return elem.getName();
  }
  
  public String getElementNamespaceUri(Object obj)
  {
    Element elem = (Element)obj;
    
    String uri = elem.getNamespaceURI();
    if (uri == null) {
      return "";
    }
    return uri;
  }
  
  public String getElementQName(Object obj)
  {
    Element elem = (Element)obj;
    
    return elem.getQualifiedName();
  }
  
  public String getAttributeName(Object obj)
  {
    Attribute attr = (Attribute)obj;
    
    return attr.getName();
  }
  
  public String getAttributeNamespaceUri(Object obj)
  {
    Attribute attr = (Attribute)obj;
    
    String uri = attr.getNamespaceURI();
    if (uri == null) {
      return "";
    }
    return uri;
  }
  
  public String getAttributeQName(Object obj)
  {
    Attribute attr = (Attribute)obj;
    
    return attr.getQualifiedName();
  }
  
  public Iterator getChildAxisIterator(Object contextNode)
  {
    Iterator result = null;
    if ((contextNode instanceof Branch))
    {
      Branch node = (Branch)contextNode;
      result = node.nodeIterator();
    }
    if (result != null) {
      return result;
    }
    return JaxenConstants.EMPTY_ITERATOR;
  }
  
  public Iterator getChildAxisIterator(Object contextNode, String localName, String namespacePrefix, String namespaceURI)
  {
    if ((contextNode instanceof Element))
    {
      Element node = (Element)contextNode;
      return node.elementIterator(QName.get(localName, namespacePrefix, namespaceURI));
    }
    if ((contextNode instanceof Document))
    {
      Document node = (Document)contextNode;
      Element el = node.getRootElement();
      if (!el.getName().equals(localName)) {
        return JaxenConstants.EMPTY_ITERATOR;
      }
      if ((namespaceURI != null) && 
        (!namespaceURI.equals(el.getNamespaceURI()))) {
        return JaxenConstants.EMPTY_ITERATOR;
      }
      return new SingleObjectIterator(el);
    }
    return JaxenConstants.EMPTY_ITERATOR;
  }
  
  public Iterator getParentAxisIterator(Object contextNode)
  {
    if ((contextNode instanceof Document)) {
      return JaxenConstants.EMPTY_ITERATOR;
    }
    Node node = (Node)contextNode;
    
    Object parent = node.getParent();
    if (parent == null) {
      parent = node.getDocument();
    }
    return new SingleObjectIterator(parent);
  }
  
  public Iterator getAttributeAxisIterator(Object contextNode)
  {
    if (!(contextNode instanceof Element)) {
      return JaxenConstants.EMPTY_ITERATOR;
    }
    Element elem = (Element)contextNode;
    
    return elem.attributeIterator();
  }
  
  public Iterator getAttributeAxisIterator(Object contextNode, String localName, String namespacePrefix, String namespaceURI)
  {
    if ((contextNode instanceof Element))
    {
      Element node = (Element)contextNode;
      Attribute attr = node.attribute(QName.get(localName, namespacePrefix, namespaceURI));
      if (attr == null) {
        return JaxenConstants.EMPTY_ITERATOR;
      }
      return new SingleObjectIterator(attr);
    }
    return JaxenConstants.EMPTY_ITERATOR;
  }
  
  public Iterator getNamespaceAxisIterator(Object contextNode)
  {
    if (!(contextNode instanceof Element)) {
      return JaxenConstants.EMPTY_ITERATOR;
    }
    Element element = (Element)contextNode;
    List nsList = new ArrayList();
    HashSet prefixes = new HashSet();
    Iterator iter;
    for (Element context = element; context != null; context = context.getParent())
    {
      List declaredNS = new ArrayList(context.declaredNamespaces());
      declaredNS.add(context.getNamespace());
      for (Iterator iter = context.attributes().iterator(); iter.hasNext();)
      {
        Attribute attr = (Attribute)iter.next();
        declaredNS.add(attr.getNamespace());
      }
      for (iter = declaredNS.iterator(); iter.hasNext();)
      {
        Namespace namespace = (Namespace)iter.next();
        if (namespace != Namespace.NO_NAMESPACE)
        {
          String prefix = namespace.getPrefix();
          if (!prefixes.contains(prefix))
          {
            prefixes.add(prefix);
            nsList.add(namespace.asXPathResult(element));
          }
        }
      }
    }
    nsList.add(Namespace.XML_NAMESPACE.asXPathResult(element));
    return nsList.iterator();
  }
  
  public Object getDocumentNode(Object contextNode)
  {
    if ((contextNode instanceof Document)) {
      return contextNode;
    }
    if ((contextNode instanceof Node))
    {
      Node node = (Node)contextNode;
      return node.getDocument();
    }
    return null;
  }
  
  public XPath parseXPath(String xpath)
    throws SAXPathException
  {
    return new Dom4jXPath(xpath);
  }
  
  public Object getParentNode(Object contextNode)
  {
    if ((contextNode instanceof Node))
    {
      Node node = (Node)contextNode;
      Object answer = node.getParent();
      if (answer == null)
      {
        answer = node.getDocument();
        if (answer == contextNode) {
          return null;
        }
      }
      return answer;
    }
    return null;
  }
  
  public String getTextStringValue(Object obj)
  {
    return getNodeStringValue((Node)obj);
  }
  
  public String getElementStringValue(Object obj)
  {
    return getNodeStringValue((Node)obj);
  }
  
  public String getAttributeStringValue(Object obj)
  {
    return getNodeStringValue((Node)obj);
  }
  
  private String getNodeStringValue(Node node)
  {
    return node.getStringValue();
  }
  
  public String getNamespaceStringValue(Object obj)
  {
    Namespace ns = (Namespace)obj;
    
    return ns.getURI();
  }
  
  public String getNamespacePrefix(Object obj)
  {
    Namespace ns = (Namespace)obj;
    
    return ns.getPrefix();
  }
  
  public String getCommentStringValue(Object obj)
  {
    Comment cmt = (Comment)obj;
    
    return cmt.getText();
  }
  
  public String translateNamespacePrefixToUri(String prefix, Object context)
  {
    Element element = null;
    if ((context instanceof Element))
    {
      element = (Element)context;
    }
    else if ((context instanceof Node))
    {
      Node node = (Node)context;
      element = node.getParent();
    }
    if (element != null)
    {
      Namespace namespace = element.getNamespaceForPrefix(prefix);
      if (namespace != null) {
        return namespace.getURI();
      }
    }
    return null;
  }
  
  public short getNodeType(Object node)
  {
    if ((node instanceof Node)) {
      return ((Node)node).getNodeType();
    }
    return 0;
  }
  
  public Object getDocument(String uri)
    throws FunctionCallException
  {
    try
    {
      return getSAXReader().read(uri);
    }
    catch (DocumentException e)
    {
      throw new FunctionCallException("Failed to parse document for URI: " + uri, e);
    }
  }
  
  public String getProcessingInstructionTarget(Object obj)
  {
    ProcessingInstruction pi = (ProcessingInstruction)obj;
    
    return pi.getTarget();
  }
  
  public String getProcessingInstructionData(Object obj)
  {
    ProcessingInstruction pi = (ProcessingInstruction)obj;
    
    return pi.getText();
  }
  
  public SAXReader getSAXReader()
  {
    if (reader == null)
    {
      reader = new SAXReader();
      reader.setMergeAdjacentText(true);
    }
    return reader;
  }
  
  public void setSAXReader(SAXReader reader)
  {
    this.reader = reader;
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom4j.DocumentNavigator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.dom4j;

import org.jaxen.BaseXPath;
import org.jaxen.JaxenException;

public class Dom4jXPath
  extends BaseXPath
{
  public Dom4jXPath(String xpathExpr)
    throws JaxenException
  {
    super(xpathExpr, DocumentNavigator.getInstance());
  }
}

/* Location:
 * Qualified Name:     org.jaxen.dom4j.Dom4jXPath
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.expr;

public abstract interface AdditiveExpr
  extends BinaryExpr
{
  public abstract String getOperator();
}

/* Location:
 * Qualified Name:     org.jaxen.expr.AdditiveExpr
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.expr;

public abstract interface AllNodeStep
  extends Step
{}

/* Location:
 * Qualified Name:     org.jaxen.expr.AllNodeStep
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.expr;

public abstract interface BinaryExpr
  extends Expr
{
  public abstract Expr getLHS();
  
  public abstract Expr getRHS();
}

/* Location:
 * Qualified Name:     org.jaxen.expr.BinaryExpr
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.expr;

public abstract interface CommentNodeStep
  extends Step
{}

/* Location:
 * Qualified Name:     org.jaxen.expr.CommentNodeStep
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.jaxen.expr;

import java.util.Collections;
import java.util.List;
import org.jaxen.Context;
import org.jaxen.ContextSupport;
import org.jaxen.JaxenException;
import org.jaxen.Navigator;
import org.jaxen.util.SingletonList;

/**
 * @deprecated
 */
public class DefaultAbsoluteLocationPath
  extends DefaultLocationPath
{
  public String toString()
  {
    return "[(DefaultAbsoluteLocationPath): " + super.toString() + "]";
  }
  
  public boolean isAbsolute()
  {
    return true;
  }
  
  public String getText()
  {
    return "/" + super.getText();
  }
  
  public Object evaluate(Context context)
    throws JaxenException
  {
    Conte
1 2 3 4 5 6 7 8 9 10

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd