scala.xml

class Node

[source: scala/xml/Node.scala]

abstract class Node
extends NodeSeq
An abstract class representing XML with nodes of a labelled tree. This class contains an implementation of a subset of XPath for navigation.
Author
Burak Emir and others
Version
1.1
Direct Known Subclasses:
Elem, Group, SpecialNode

Method Summary
final def attribute (key : java.lang.String) : Option[Seq[Node]]
Convenience method, looks up an unprefixed attribute in attributes of this node. Same as attributes.getValue(key)
final def attribute (uri : java.lang.String, key : java.lang.String) : Option[Seq[Node]]
Convenience method, looks up a prefixed attribute in attributes of this node. Same as attributes.getValue(uri, this, key)
def attributes : MetaData
Returns attribute meaning all attributes of this node, prefixed and unprefixed, in no particular order. In class Node, this defaults to Null (the empty attribute list).
def buildString (stripComments : Boolean) : java.lang.String
String representation of this node
abstract def child : Seq[Node]
Returns child axis i.e. all children of this node.
def descendant : List[Node]
Descendant axis (all descendants of this node, not including node itself) includes all text nodes, element nodes, comments and processing instructions.
def descendant_or_self : List[Node]
Descendant axis (all descendants of this node, including thisa node) includes all text nodes, element nodes, comments and processing instructions.
def doCollectNamespaces : Boolean
The logic formerly found in typeTag$, as best I could infer it.
def doTransform : Boolean
override def equals (x : Any) : Boolean
Returns true if x is structurally equal to this node. Compares prefix, label, attributes and children.
def getNamespace (pre : java.lang.String) : java.lang.String
Convenience method, same as scope.getURI(pre) but additionally checks if scope is null.
override def hashCode : Int
def isAtom : Boolean
used internally. Atom/Molecule = -1 PI = -2 Comment = -3 EntityRef = -5
abstract def label : java.lang.String
label of this node. I.e. "foo" for <foo/>)
def nameToString (sb : StringBuilder) : StringBuilder
Appends qualified name of this node to StringBuilder.
def namespace : java.lang.String
convenience, same as getNamespace(this.prefix)
def prefix : java.lang.String
prefix of this node
def scope : NamespaceBinding
method returning the namespace bindings of this node. by default, this is TopScope, which means there are no namespace bindings except the predefined one for "xml".
override def text : java.lang.String
Returns a text representation of this node. Note that this is not equivalent to the XPath node-test called text(), it is rather an implementation of the XPath function string() Martin to Burak: to do: if you make this method abstract, the compiler will now complain if there's no implementation in a subclass. Is this what we want? Note that this would break doc/DocGenator and doc/ModelToXML, with an error message like: doc\DocGenerator.scala:1219: error: object creation impossible, since there is a deferred declaration of method text in class Node of type => String which is not implemented in a subclass new SpecialNode { ^
def theSeq : Seq[Node]
returns a sequence consisting of only this node
override def toString : java.lang.String
Same as toString(false).
def xmlType : TypeSymbol
Returns a type symbol (e.g. DTD, XSD), default null.
Methods inherited from NodeSeq
newBuilder, length, iterator, apply, apply, \, \\
Methods inherited from Seq
companion
Methods inherited from SeqLike
thisCollection, toCollection, lengthCompare, size, isDefinedAt, segmentLength, prefixLength, indexWhere, indexWhere, findIndexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexWhere, lastIndexWhere, reverse, reverseMap, reverseIterator, reversedElements, startsWith, startsWith, endsWith, indexOfSeq, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, contains, union, diff, intersect, removeDuplicates, patch, updated, +:, :+, padTo, sortWith, sortWith, sortBy, toSeq, indices, view, view, findLastIndexOf, equalsWith, containsSlice, projection
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from IterableLike
elements, foreach, forall, exists, find, isEmpty, foldRight, reduceRight, toIterable, head, take, slice, takeWhile, takeRight, dropRight, copyToArray, zip, zipAll, zipWithIndex, sameElements, toStream, canEqual, first, firstOption
Methods inherited from GenericTraversableTemplate
genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableLike
repr, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, count, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, tail, last, lastOption, init, drop, dropWhile, span, splitAt, copyToBuffer, copyToArray, toArray, toList, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, addString, stringPrefix, withFilter
Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
def prefix : java.lang.String
prefix of this node

abstract def label : java.lang.String
label of this node. I.e. "foo" for <foo/>)

def isAtom : Boolean
used internally. Atom/Molecule = -1 PI = -2 Comment = -3 EntityRef = -5

def doCollectNamespaces : Boolean
The logic formerly found in typeTag$, as best I could infer it.

def doTransform : Boolean

def scope : NamespaceBinding
method returning the namespace bindings of this node. by default, this is TopScope, which means there are no namespace bindings except the predefined one for "xml".

def namespace : java.lang.String
convenience, same as getNamespace(this.prefix)

def getNamespace(pre : java.lang.String) : java.lang.String
Convenience method, same as scope.getURI(pre) but additionally checks if scope is null.
Parameters
pre - the prefix whose namespace name we would like to obtain
Returns
the namespace if scope != null and prefix was found, else null

final def attribute(key : java.lang.String) : Option[Seq[Node]]
Convenience method, looks up an unprefixed attribute in attributes of this node. Same as attributes.getValue(key)
Parameters
key - of queried attribute.
Returns
value of UnprefixedAttribute with given key in attributes, if it exists, otherwise null.

final def attribute(uri : java.lang.String, key : java.lang.String) : Option[Seq[Node]]
Convenience method, looks up a prefixed attribute in attributes of this node. Same as attributes.getValue(uri, this, key)
Parameters
uri - namespace of queried attribute (may not be null).
key - of queried attribute.
Returns
value of PrefixedAttribute with given namespace and given key, otherwise null.

def attributes : MetaData
Returns attribute meaning all attributes of this node, prefixed and unprefixed, in no particular order. In class Node, this defaults to Null (the empty attribute list).
Returns
all attributes of this node

abstract def child : Seq[Node]
Returns child axis i.e. all children of this node.
Returns
all children of this node

def descendant : List[Node]
Descendant axis (all descendants of this node, not including node itself) includes all text nodes, element nodes, comments and processing instructions.

def descendant_or_self : List[Node]
Descendant axis (all descendants of this node, including thisa node) includes all text nodes, element nodes, comments and processing instructions.

override def equals(x : Any) : Boolean
Returns true if x is structurally equal to this node. Compares prefix, label, attributes and children.
Parameters
x - ...
Returns
true if ..
Overrides
NodeSeq.equals

override def hashCode : Int

Returns a hashcode.


def theSeq : Seq[Node]
returns a sequence consisting of only this node
Overrides
NodeSeq.theSeq

def buildString(stripComments : Boolean) : java.lang.String
String representation of this node
Parameters
stripComment - if true, strips comment nodes from result
Returns
...

override def toString : java.lang.String
Same as toString(false).
See Also
toString(Boolean)
Overrides
NodeSeq.toString

def nameToString(sb : StringBuilder) : StringBuilder
Appends qualified name of this node to StringBuilder.
Parameters
sb - ...
Returns
...

def xmlType : TypeSymbol
Returns a type symbol (e.g. DTD, XSD), default null.

override def text : java.lang.String
Returns a text representation of this node. Note that this is not equivalent to the XPath node-test called text(), it is rather an implementation of the XPath function string() Martin to Burak: to do: if you make this method abstract, the compiler will now complain if there's no implementation in a subclass. Is this what we want? Note that this would break doc/DocGenator and doc/ModelToXML, with an error message like: doc\DocGenerator.scala:1219: error: object creation impossible, since there is a deferred declaration of method text in class Node of type => String which is not implemented in a subclass new SpecialNode { ^
Overrides
NodeSeq.text