On this page
[Java] Class Attribute
- groovy.xml.slurpersupport.Attribute
public class Attribute
extends GPathResult
Lazy evaluated representation of a node attribute.
Fields inherited from class | Fields |
---|---|
class GPathResult |
name, namespaceMap, namespacePrefix, namespaceTagHints, parent |
Constructor Summary
Constructor and description |
---|
Attribute(String name, String value, GPathResult parent, String namespacePrefix, Map<String, String> namespaceTagHints)
|
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
protected void |
appendNode(Object newValue) NOP, because an node can not be appended to an attribute. |
|
public void |
build(GroovyObject builder) |
|
public Iterator |
childNodes() Throws a GroovyRuntimeException , because an attribute can have no children. |
|
public GPathResult |
find(Closure closure) |
|
public GPathResult |
findAll(Closure closure) |
|
public Iterator |
iterator() |
|
public String |
name() |
|
public String |
namespaceURI() Returns the URI of the namespace of this Attribute. |
|
public Iterator |
nodeIterator() |
|
public GPathResult |
parents() Throws a GroovyRuntimeException , because this method is not implemented yet. |
|
protected void |
replaceBody(Object newValue) NOP, because an attribute does not have a Body. |
|
protected void |
replaceNode(Closure newValue) NOP, because an attribute does not have any Node to replace. |
|
public int |
size() Returns the size of this Attribute, which is always 1 . |
|
public String |
text() Returns the value of this Attribute. |
|
public Writer |
writeTo(Writer out) |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class GPathResult |
appendNode, breadthFirst, childNodes, children, createIterator, declareNamespace, depthFirst, doCall, doCall, equals, find, findAll, getAt, getAt, getAttribute, getBody, getProperty, hasNext, hasNext, hasNext, hashCode, isEmpty, iterator, leftShift, list, lookupNamespace, name, next, next, next, nodeIterator, parent, parents, plus, plus, pop, putAt, remove, remove, remove, replaceBody, replaceNode, setAttribute, setMetaClass, setProperty, size, text, toBigDecimal, toBigInteger, toBoolean, toDouble, toFloat, toInteger, toLong, toString, toURI, toURL |
class GroovyObjectSupport |
getMetaClass, setMetaClass |
Constructor Detail
public Attribute(String name, String value, GPathResult parent, String namespacePrefix, Map<String, String> namespaceTagHints)
- Parameters:
name
- of the attributevalue
- of the attributeparent
- the GPathResult prior to the application of the expression creating this GPathResultnamespacePrefix
- the namespace prefix if anynamespaceTagHints
- the known tag to namespace mappings
Method Detail
@Override protected void appendNode(Object newValue)
NOP, because an node can not be appended to an attribute.
@Override public void build(GroovyObject builder)
@Override public Iterator childNodes()
Throws a GroovyRuntimeException
, because an attribute can have no children.
@Override public GPathResult find(Closure closure)
@Override public GPathResult findAll(Closure closure)
@Override public Iterator iterator()
@Override public String name()
public String namespaceURI()
Returns the URI of the namespace of this Attribute.
- Returns:
- the namespace of this Attribute
@Override public Iterator nodeIterator()
@Override public GPathResult parents()
Throws a GroovyRuntimeException
, because this method is not implemented yet.
@Override protected void replaceBody(Object newValue)
NOP, because an attribute does not have a Body.
@Override protected void replaceNode(Closure newValue)
NOP, because an attribute does not have any Node to replace.
@Override public int size()
Returns the size of this Attribute, which is always 1
.
- Returns:
-
1
@Override public String text()
Returns the value of this Attribute.
- Returns:
- the value of this Attribute
@Override public Writer writeTo(Writer out)
© 2003-2022 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/4.0.0/html/gapi/groovy/xml/slurpersupport/Attribute.html