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; }
protected void writeContent(Branch branch, NamespaceStack namespaceStack) throws SAXException { for (Iterator<Node> iter = branch.nodeIterator(); iter.hasNext();) { Node node = iter.next(); if (node instanceof Element) { write((Element) node, namespaceStack); } else if (node instanceof CharacterData) { if (node instanceof Text) { Text text = (Text) node; write(text.getText()); } else if (node instanceof CDATA) { write((CDATA) node); } else if (node instanceof Comment) { write((Comment) node); } else { throw new SAXException("Invalid Node in DOM4J content: " + node + " of type: " + node.getClass()); } } else if (node instanceof Entity) { write((Entity) node); } else if (node instanceof ProcessingInstruction) { write((ProcessingInstruction) node); } else if (node instanceof Namespace) { write((Namespace) node); } else { throw new SAXException("Invalid Node in DOM4J content: " + node); } } }
/** * <p>Removes whitespace-only {@link Text} nodes without siblings from a given {@link Node} and its descendants.</p> * * @param node The node from which to remove whitespace-only {@link Text} nodes without siblings. */ public static void removeWhitespaceWithoutSiblings(final Node node) { if (node instanceof Branch) { final Branch branch = (Branch) node; if (branch.nodeCount() > 1) { final Iterator<Node> childIterator = branch.nodeIterator(); while (childIterator.hasNext()) { final Node child = childIterator.next(); if (child instanceof Text) { final Text text = (Text) child; if (text.getText().trim().length() == 0) { childIterator.remove(); continue; } } removeWhitespaceWithoutSiblings(child); } } } }
protected void writeContent(Branch branch, NamespaceStack namespaceStack) throws SAXException { for (Iterator<Node> iter = branch.nodeIterator(); iter.hasNext();) { Node node = iter.next(); if (node instanceof Element) { write((Element) node, namespaceStack); } else if (node instanceof CharacterData) { if (node instanceof Text) { Text text = (Text) node; write(text.getText()); } else if (node instanceof CDATA) { write((CDATA) node); } else if (node instanceof Comment) { write((Comment) node); } else { throw new SAXException("Invalid Node in DOM4J content: " + node + " of type: " + node.getClass()); } } else if (node instanceof Entity) { write((Entity) node); } else if (node instanceof ProcessingInstruction) { write((ProcessingInstruction) node); } else if (node instanceof Namespace) { write((Namespace) node); } else { throw new SAXException("Invalid Node in DOM4J content: " + node); } } }
protected void writeContent(Branch branch, NamespaceStack namespaceStack) throws SAXException { for (Iterator<Node> iter = branch.nodeIterator(); iter.hasNext();) { Node node = iter.next(); if (node instanceof Element) { write((Element) node, namespaceStack); } else if (node instanceof CharacterData) { if (node instanceof Text) { Text text = (Text) node; write(text.getText()); } else if (node instanceof CDATA) { write((CDATA) node); } else if (node instanceof Comment) { write((Comment) node); } else { throw new SAXException("Invalid Node in DOM4J content: " + node + " of type: " + node.getClass()); } } else if (node instanceof Entity) { write((Entity) node); } else if (node instanceof ProcessingInstruction) { write((ProcessingInstruction) node); } else if (node instanceof Namespace) { write((Namespace) node); } else { throw new SAXException("Invalid Node in DOM4J content: " + node); } } }
protected void writeContent(Branch branch, NamespaceStack namespaceStack) throws SAXException { for (Iterator iter = branch.nodeIterator(); iter.hasNext();) { Object object = iter.next();
protected void writeContent(Branch branch, NamespaceStack namespaceStack) throws SAXException { for (Iterator iter = branch.nodeIterator(); iter.hasNext();) { Object object = iter.next();
protected void writeContent(Branch branch, NamespaceStack namespaceStack) throws SAXException { for (Iterator iter = branch.nodeIterator(); iter.hasNext();) { Object object = iter.next();
protected void writeContent(Branch branch, NamespaceStack namespaceStack) throws SAXException { for (Iterator iter = branch.nodeIterator(); iter.hasNext();) { Object object = iter.next();
protected void writeContent(Branch branch, NamespaceStack namespaceStack) throws SAXException { for (Iterator iter = branch.nodeIterator(); iter.hasNext();) { Object object = iter.next();
protected void writeContent(Branch branch, NamespaceStack namespaceStack) throws SAXException { for (Iterator iter = branch.nodeIterator(); iter.hasNext();) { Object object = iter.next();
for ( Iterator i = modules.nodeIterator(); i.hasNext(); )
protected void testBranchPath(Branch branch) { testNodePath(branch); if (branch instanceof Element) { Element element = (Element) branch; for (Iterator iter = element.attributeIterator(); iter.hasNext();) { Node node = (Node) iter.next(); testNodePath(node); } } for (Iterator iter = branch.nodeIterator(); iter.hasNext();) { Node node = (Node) iter.next(); if (node instanceof Branch) { testBranchPath((Branch) node); } else { testNodePath(node); } } }