/** * @see org.apache.xalan.dom3.xpath.XPathNamespace#getOwnerElement() */ public Element getOwnerElement() { return ((Attr)m_attributeNode).getOwnerElement(); }
protected Node getFirstNode (Node n) { // We can assume castability here because we've already // tested the node type. return ((Attr)n).getOwnerElement(); } protected Node getNextNode (Node n) {
/** * 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; }
/** * Return the XPath parent of the supplied DOM node. * XPath has slightly different definition of parent than DOM does. * In particular, the parent of an attribute is not null. * * @param child the child node * * @return the parent of the specified node; or null if * the node does not have a parent */ public Object getParentNode(Object child) { Node node = (Node) child; if (node.getNodeType() == Node.ATTRIBUTE_NODE) { return ((Attr) node).getOwnerElement(); } return node.getParentNode(); }
/** * 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; }
public TemplateNodeModel getParentNode() { if (parent == null) { Node parentNode = node.getParentNode(); if (parentNode == null) { if (node instanceof Attr) { parentNode = ((Attr) node).getOwnerElement(); } } parent = wrap(parentNode); } return parent; }
/** * Returns true if the descendantOrSelf is on the descendant-or-self axis * of the context node. * * @param ctx * @param descendantOrSelf * @return true if the node is descendant */ public static boolean isDescendantOrSelf(Node ctx, Node descendantOrSelf) { if (ctx == descendantOrSelf) { return true; } Node parent = descendantOrSelf; while (true) { if (parent == null) { return false; } if (parent == ctx) { return true; } if (parent.getNodeType() == Node.ATTRIBUTE_NODE) { parent = ((Attr) parent).getOwnerElement(); } else { parent = parent.getParentNode(); } } }
/** * This method returns the first non-null owner document of the Nodes in this Set. * This method is necessary because it <I>always</I> returns a * {@link Document}. {@link Node#getOwnerDocument} returns <CODE>null</CODE> * if the {@link Node} is a {@link Document}. * * @param xpathNodeSet * @return the owner document */ public static Document getOwnerDocument(Set<Node> xpathNodeSet) { NullPointerException npe = null; for (Node node : xpathNodeSet) { int nodeType = node.getNodeType(); if (nodeType == Node.DOCUMENT_NODE) { return (Document) node; } try { if (nodeType == Node.ATTRIBUTE_NODE) { return ((Attr)node).getOwnerElement().getOwnerDocument(); } return node.getOwnerDocument(); } catch (NullPointerException e) { npe = e; } } throw new NullPointerException(I18n.translate("endorsed.jdk1.4.0") + " Original message was \"" + (npe == null ? "" : npe.getMessage()) + "\""); }
(cursor.getNodeType()!=ATTRIBUTE_NODE) ? cursor.getParentNode() : ((org.w3c.dom.Attr)cursor).getOwnerElement())
NodeOutputter(Node node) { if (node instanceof Element) { setContext((Element) node); } else if (node instanceof Attr) { setContext(((Attr) node).getOwnerElement()); } else if (node instanceof Document) { setContext(((Document) node).getDocumentElement()); } }
(cursor.getNodeType()!=ATTRIBUTE_NODE) ? cursor.getParentNode() : ((org.w3c.dom.Attr)cursor).getOwnerElement())
if (foundElement == null) { foundElement = attr.getOwnerElement(); } else { log.debug("Multiple elements with the same 'Id' attribute value!");
/** * This method throws an exception if the Attribute value contains * a relative URI. * * @param attr * @throws CanonicalizationException */ public static void assertNotRelativeNS(Attr attr) throws CanonicalizationException { if (attr == null) { return; } String nodeAttrName = attr.getNodeName(); boolean definesDefaultNS = nodeAttrName.equals("xmlns"); boolean definesNonDefaultNS = nodeAttrName.startsWith("xmlns:"); if ((definesDefaultNS || definesNonDefaultNS) && namespaceIsRelative(attr)) { String parentName = attr.getOwnerElement().getTagName(); String attrValue = attr.getValue(); Object exArgs[] = { parentName, nodeAttrName, attrValue }; throw new CanonicalizationException( "c14n.Canonicalizer.RelativeNamespace", exArgs ); } }
if(impl!=null && impl.hasFeature("Core","2.0")) parent=((Attr)node).getOwnerElement(); return parent;
/** * Returns the element whose namespace definitions apply to this node. Use * this element when mapping prefixes to URIs and vice versa. */ private NodeImpl getNamespacingElement() { switch (this.getNodeType()) { case ELEMENT_NODE: return this; case DOCUMENT_NODE: return (NodeImpl) ((Document) this).getDocumentElement(); case ENTITY_NODE: case NOTATION_NODE: case DOCUMENT_FRAGMENT_NODE: case DOCUMENT_TYPE_NODE: return null; case ATTRIBUTE_NODE: return (NodeImpl) ((Attr) this).getOwnerElement(); case TEXT_NODE: case CDATA_SECTION_NODE: case ENTITY_REFERENCE_NODE: case PROCESSING_INSTRUCTION_NODE: case COMMENT_NODE: return getContainingElement(); default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Unsupported node type " + getNodeType()); } }
if(impl!=null && impl.hasFeature("Core","2.0")) parent=((Attr)node).getOwnerElement(); return parent;
Node p = (root.getNodeType() == Node.ATTRIBUTE_NODE) ? ((org.w3c.dom.Attr)root).getOwnerElement() : root.getParentNode(); for (; p != null; p = p.getParentNode()) handle=dtm.getHandleOfNode(((org.w3c.dom.Attr)node).getOwnerElement()); handle=dtm.getAttributeNode(handle,node.getNamespaceURI(),node.getLocalName());
Node p = (root.getNodeType() == Node.ATTRIBUTE_NODE) ? ((org.w3c.dom.Attr)root).getOwnerElement() : root.getParentNode(); for (; p != null; p = p.getParentNode()) handle=dtm.getHandleOfNode(((org.w3c.dom.Attr)node).getOwnerElement()); handle=dtm.getAttributeNode(handle,node.getNamespaceURI(),node.getLocalName());
MsgKey.ER_WF_LT_IN_ATTVAL, new Object[] { ((Attr) node).getOwnerElement().getNodeName(), node.getNodeName()});
MsgKey.ER_WF_LT_IN_ATTVAL, new Object[] { ((Attr) node).getOwnerElement().getNodeName(), node.getNodeName()});