public Object getParentNode(Object o) { return (o instanceof Node ? ((Node)o).getParent() : null); }
public Object getDocumentNode(Object o) { ParentNode parent = null; if (o instanceof ParentNode) { parent = (ParentNode)o; } else if (o instanceof Node) { parent = ((Node)o).getParent(); } return parent.getDocument(); }
public String translateNamespacePrefixToUri(String s, Object o) { Element element = null; if (o instanceof Element) { element = (Element) o; } else if (o instanceof ParentNode) { } else if (o instanceof Node) { element = (Element)((Node)o).getParent(); } else if (o instanceof XPathNamespace) { element = ((XPathNamespace)o).getElement(); } if (element != null) { return element.getNamespaceURI(s); } return null; }
public Iterator getParentAxisIterator(Object o) { Object parent = null; if (o instanceof Node) { parent = ((Node)o).getParent(); } else if (isNamespace(o)) { parent = ((XPathNamespace)o).getElement(); } return (parent != null ? new SingleObjectIterator(parent) : null); }
private static Node getAbsoluteAncestor( final Element rbody) { Node n = rbody; for (;;) { final ParentNode p = n.getParent(); if (p == null) { return n; } n = p; } }
/** * Get the NodeInfo object representing the parent of this node */ public SteppingNode getParent() { if (parent == null) { ParentNode p = node.getParent(); if (p != null) parent = makeWrapper(p, docWrapper); } return parent; }
/** * Get the NodeInfo object representing the parent of this node */ public XOMNodeWrapper getParent() { if (parent == null) { ParentNode p = node.getParent(); if (p != null) parent = makeWrapper(p, docWrapper); } return parent; }
/** * Get the NodeInfo object representing the parent of this node */ public XOMNodeWrapper getParent() { if (parent == null) { ParentNode p = node.getParent(); if (p != null) parent = makeWrapper(p, docWrapper); } return parent; }
/** * Create a Saxon wrapper for a XOM root node * * @param root The XOM root node * @param config The configuration which defines the name pool used for all * names in this tree */ public XOMDocumentWrapper(Node root, Configuration config) { super(root, null, 0); if (root.getParent() != null) throw new IllegalArgumentException("root node must not have a parent node"); docWrapper = this; treeInfo = this; setConfiguration(config); }
/** * Get owner molecule. * * @return owner molecule */ public CMLMolecule getMolecule() { Node atomArray = this.getParent(); if (atomArray != null) { Node grandParent = atomArray.getParent(); if (grandParent != null && grandParent instanceof CMLMolecule) { return (CMLMolecule) grandParent; } } return null; }
/** * Create a Saxon wrapper for a XOM root node * * @param root The XOM root node * @param config The configuration which defines the name pool used for all * names in this tree */ public XOMDocumentWrapper(Node root, Configuration config) { super(root, null, 0); if (root.getParent() != null) throw new IllegalArgumentException("root node must not have a parent node"); docWrapper = this; treeInfo = this; setConfiguration(config); }
/** * Converts a xom node into something readable by Saxon * @param node * @param config * @return */ static NodeInfo wrap(Node node, Configuration config) { if (node == null) throw new IllegalArgumentException("node must not be null"); //$NON-NLS-1$ if (node instanceof DocType) throw new IllegalArgumentException("DocType can't be queried by XQuery/XPath"); //$NON-NLS-1$ Node root = node; while (root.getParent() != null) { root = root.getParent(); } XOMDocumentWrapper docWrapper = new XOMDocumentWrapper(root, config); return docWrapper.wrap(node); }
/** * Converts a xom node into something readable by Saxon * @param node * @param config * @return */ static NodeInfo wrap(Node node, Configuration config) { if (node == null) throw new IllegalArgumentException("node must not be null"); //$NON-NLS-1$ if (node instanceof DocType) throw new IllegalArgumentException("DocType can't be queried by XQuery/XPath"); //$NON-NLS-1$ Node root = node; while (root.getParent() != null) { root = root.getParent(); } XOMDocumentWrapper docWrapper = new XOMDocumentWrapper(root, config); return docWrapper.wrap(node); }
/** * Create a Saxon wrapper for a XOM root node * * @param root * The XOM root node * @param baseURI * The base URI for all the nodes in the tree * @param config * The configuration which defines the name pool used for all * names in this tree */ public XOMDocumentWrapper(Node root, String baseURI, Configuration config) { super(root, null, 0); if (root.getParent() != null) throw new IllegalArgumentException("root node must not have a parent node"); this.baseURI = baseURI; docWrapper = this; setConfiguration(config); }
/** * Converts a xom node into something readable by Saxon * @param node * @param config * @return */ static NodeInfo wrap(Node node, Configuration config) { if (node == null) throw new IllegalArgumentException("node must not be null"); //$NON-NLS-1$ if (node instanceof DocType) throw new IllegalArgumentException("DocType can't be queried by XQuery/XPath"); //$NON-NLS-1$ Node root = node; while (root.getParent() != null) { root = root.getParent(); } XOMDocumentWrapper docWrapper = new XOMDocumentWrapper(root, root.getBaseURI(), config); return docWrapper.wrap(node); }
/** * get previous sibling. * * @param current * @return previous sibling */ public static Node getPrecedingSibling(Node current) { Node node = null; if (current != null) { ParentNode parent = current.getParent(); if (parent != null) { int index = parent.indexOf(current); if (index > 0) { node = parent.getChild(index - 1); } } } return node; }
public XOMNodeWrapper getPreviousSibling() { ParentNode parenti = node.getParent(); if (parenti == null) { return null; } if (index != -1) { if ((index - 1) > 0) { return makeWrapper(parenti.getChild(index - 1), docWrapper, parent, index - 1); } else { return null; } } index = parenti.indexOf(node); if (index - 1 > 0) { return makeWrapper(parenti.getChild(index - 1), docWrapper, parent, index - 1); } return null; }
public XOMNodeWrapper getPreviousSibling() { ParentNode parenti = node.getParent(); if (parenti == null) { return null; } if (index != -1) { if ((index - 1) > 0) { return makeWrapper(parenti.getChild(index - 1), docWrapper, parent, index - 1); } else { return null; } } index = parenti.indexOf(node); if (index - 1 > 0) { return makeWrapper(parenti.getChild(index - 1), docWrapper, parent, index - 1); } return null; }
public SteppingNode getPreviousSibling() { ParentNode parenti = node.getParent(); if (parenti == null) { return null; } if (index != -1) { if ((index - 1) > 0) { return makeWrapper(parenti.getChild(index - 1), docWrapper, parent, index - 1); } else { return null; } } index = parenti.indexOf(node); if (index - 1 > 0) { return makeWrapper(parenti.getChild(index - 1), docWrapper, parent, index - 1); } return null; }
public XOMNodeWrapper getNextSibling() { ParentNode parenti = node.getParent(); if (parenti == null) { return null; } int count = parenti.getChildCount(); if (index != -1) { if ((index + 1) < count) { return makeWrapper(parenti.getChild(index + 1), docWrapper, parent, index + 1); } else { return null; } } index = parenti.indexOf(node); if (index + 1 < count) { return makeWrapper(parenti.getChild(index + 1), docWrapper, parent, index + 1); } return null; }