/** * 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 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; } };
/** * @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; } }
/** * Creates a list of objects representing this GPathResult. * * @return a list representing of this GPathResult */ public List list() { final Iterator iter = nodeIterator(); final List result = new LinkedList(); while (iter.hasNext()) { result.add(new NodeChild((Node) iter.next(), this.parent, this.namespacePrefix, this.namespaceTagHints)); } return result; }
public Object next() { return new NodeChild((Node) iter.next(), pop(), namespaceTagHints); }
public GPathResult parent() { if (node.parent() != null) return new NodeChild(node.parent(), this, namespaceTagHints); else return this; }
protected Object getNextNode(final Iterator iter) { while (iter.hasNext()) { final Object next = iter.next(); if (next instanceof Attribute) { return next; } else { String attributeKey = Attributes.this.attributeName; if (Attributes.this.namespacePrefix != null && !"*".equals(Attributes.this.namespacePrefix) && Attributes.this.namespacePrefix.length() > 0) { attributeKey = new QName(Attributes.this.lookupNamespace(Attributes.this.namespacePrefix), Attributes.this.attributeName).toString(); } final String value = (String) ((Node) next).attributes().get(attributeKey); if (value != null) { return new Attribute(Attributes.this.name, value, new NodeChild((Node) next, Attributes.this.parent.parent, "", Attributes.this.namespaceTagHints), (Attributes.this.namespacePrefix == null || "*".equals(Attributes.this.namespacePrefix)) ? "" : Attributes.this.namespacePrefix, Attributes.this.namespaceTagHints); } } } return null; } };
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}); } } } };
/** * @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 { return new NodeChild(this.currentNode, null, this.namespaceTagHints); } finally { this.currentNode = null; } }
/** * @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 { return new NodeChild(currentNode, null, namespaceTagHints); } finally { currentNode = null; } }
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; } };
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; } };
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; } };
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; } };
public List list() { final Iterator iter = nodeIterator(); final List result = new LinkedList(); while (iter.hasNext()) { result.add(new NodeChild((Node) iter.next(), this.parent, this.namespacePrefix, this.namespaceTagHints)); } return result; }
public List list() { final Iterator iter = nodeIterator(); final List result = new LinkedList(); while (iter.hasNext()) { result.add(new NodeChild((Node) iter.next(), this.parent, this.namespacePrefix, this.namespaceTagHints)); } return result; }
/** * Creates a list of objects representing this GPathResult. * * @return a list representing of this GPathResult */ public List list() { final Iterator iter = nodeIterator(); final List result = new LinkedList(); while (iter.hasNext()) { result.add(new NodeChild((Node) iter.next(), this.parent, this.namespacePrefix, this.namespaceTagHints)); } return result; }
public List list() { final Iterator iter = nodeIterator(); final List result = new LinkedList(); while (iter.hasNext()) { result.add(new NodeChild((Node) iter.next(), this.parent, this.namespacePrefix, this.namespaceTagHints)); } return result; }
public List list() { final Iterator iter = nodeIterator(); final List result = new LinkedList(); while (iter.hasNext()) { result.add(new NodeChild((Node) iter.next(), this.parent, this.namespacePrefix, this.namespaceTagHints)); } return result; }
public GPathResult parent() { if (node.parent() != null) return new NodeChild(node.parent(), this, namespaceTagHints); else return this; }