final NodeChild child = (NodeChild) iter.next(); child.attributes().put(property.substring(1), newValue);
/** * Creates a Closure representing the body of this GPathResult. * * @return the body of this GPathResult, converted to a <code>Closure</code> */ public Closure getBody() { return new Closure(this.parent,this) { public void doCall(Object[] args) { final GroovyObject delegate = (GroovyObject)getDelegate(); final GPathResult thisObject = (GPathResult)getThisObject(); Node node = (Node)thisObject.getAt(0); List children = node.children(); for (Object child : children) { delegate.getProperty("mkp"); if (child instanceof Node) { delegate.invokeMethod("yield", new Object[]{new NodeChild((Node) child, thisObject, "*", null)}); } else { delegate.invokeMethod("yield", new Object[]{child}); } } } }; }
protected void appendNode(final Object newValue) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild result = (NodeChild) iter.next(); result.appendNode(newValue); } } }
protected void replaceNode(final Closure newValue) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild result = (NodeChild) iter.next(); result.replaceNode(newValue); } }
protected void replaceBody(final Object newValue) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild result = (NodeChild) iter.next(); result.replaceBody(newValue); } }
public GPathResult findAll(final Closure closure) { return find(closure); }
private void walkXml(IndentPrinter printer, NodeChild node) { printer.printIndent(); printer.print(node.name()); if (!node.attributes().isEmpty()) { printer.print("("); List<String> attrs = new ArrayList<>(); for (Object o : node.attributes().entrySet()) { Map.Entry<?, ?> entry = (Map.Entry<?, ?>) o; attrs.add(entry.getKey() + ": " + entry.getValue()); if (node.children().size() > 0) { printer.println(" {"); printer.incrementIndent(); for (Iterator<?> iter = node.childNodes(); iter.hasNext(); ) { Object child = iter.next(); if (child instanceof NodeChild) { printer.printIndent(); printer.println("}"); } else if (!node.attributes().isEmpty()) { printer.println(""); } else {
protected void replaceNode(final Closure newValue) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild result = (NodeChild) iter.next(); result.replaceNode(newValue); } }
protected void replaceBody(final Object newValue) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild result = (NodeChild) iter.next(); result.replaceBody(newValue); } }
public GPathResult findAll(final Closure closure) { return find(closure); }
protected Object getNextNode(final Iterator iter) { while (iter.hasNext()) { final Object node = iter.next(); if (closureYieldsTrueForNode(new NodeChild((Node) node, FilteredNodeChildren.this.parent, FilteredNodeChildren.this.namespaceTagHints))) { return node; } } return null; } };
final NodeChild child = (NodeChild)iter.next(); child.attributes().put(property.substring(1), newValue);
protected void appendNode(final Object newValue) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild result = (NodeChild) iter.next(); result.appendNode(newValue); } } }
protected void replaceNode(final Closure newValue) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild result = (NodeChild) iter.next(); result.replaceNode(newValue); } }
protected void replaceBody(final Object newValue) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild result = (NodeChild) iter.next(); result.replaceBody(newValue); } }
public GPathResult findAll(final Closure closure) { return find(closure); }
/** * @return The GPathResult instance created by consuming a stream of SAX events * Note if one of the parse methods has been called then this returns null * Note if this is called more than once all calls after the first will return null */ public GPathResult getDocument() { try { // xml namespace is always defined if (namespaceAware) { namespaceTagHints.put("xml", "http://www.w3.org/XML/1998/namespace"); } return new NodeChild(currentNode, null, namespaceTagHints); } finally { currentNode = null; } }
final NodeChild child = (NodeChild)iter.next(); child.attributes().put(property.substring(1), newValue);
protected void appendNode(final Object newValue) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild result = (NodeChild) iter.next(); result.appendNode(newValue); } } }
protected void replaceNode(final Closure newValue) { final Iterator iter = iterator(); while (iter.hasNext()) { final NodeChild result = (NodeChild) iter.next(); result.replaceNode(newValue); } }