org.basex.query.value.node
Class FElem

java.lang.Object
  extended by org.basex.data.ExprInfo
      extended by org.basex.query.expr.Expr
          extended by org.basex.query.value.Value
              extended by org.basex.query.value.item.Item
                  extended by org.basex.query.value.node.ANode
                      extended by org.basex.query.value.node.FNode
                          extended by org.basex.query.value.node.FElem
All Implemented Interfaces:
java.lang.Iterable<Item>

public final class FElem
extends FNode

Element node fragment.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.basex.query.expr.Expr
Expr.Flag
 
Field Summary
 
Fields inherited from class org.basex.query.value.node.ANode
id
 
Fields inherited from class org.basex.query.value.item.Item
score, UNDEF
 
Fields inherited from class org.basex.query.value.Value
type
 
Constructor Summary
FElem(byte[] nm)
          Convenience constructor for creating an element.
FElem(byte[] local, byte[] uri)
          Convenience constructor for creating an element with a new namespace.
FElem(byte[] prefix, byte[] local, byte[] uri)
          Convenience constructor for creating an element with a new namespace.
FElem(org.w3c.dom.Element elem, ANode p, TokenMap nss)
          Constructor for creating an element from a DOM node.
FElem(QNm n)
          Constructor for creating an element.
FElem(QNm nm, Atts nsp, ANodeList ch, ANodeList at)
          Constructor for creating an element with nodes, attributes and namespace declarations.
FElem(java.lang.String nm)
          Convenience constructor for creating an element.
FElem(java.lang.String local, java.lang.String uri)
          Convenience constructor for creating an element with a new namespace.
FElem(java.lang.String prefix, java.lang.String local, java.lang.String uri)
          Convenience constructor for creating an element with a new namespace.
 
Method Summary
 FElem add(ANode node)
          Adds a node and updates its parent reference.
 FElem add(byte[] text)
          Creates and adds a text node if the specified value is not empty.
 FElem add(byte[] nm, byte[] value)
          Adds an attribute and updates its parent reference.
 FElem add(byte[] nm, java.lang.String value)
          Adds an attribute and updates its parent reference.
 FElem add(QNm nm, byte[] value)
          Adds an attribute and updates its parent reference.
 FElem add(QNm nm, java.lang.String value)
          Adds an attribute and updates its parent reference.
 FElem add(java.lang.String text)
          Creates and adds a text node if the specified value is not empty.
 FElem add(java.lang.String nm, byte[] value)
          Adds an attribute and updates its parent reference.
 FElem add(java.lang.String nm, java.lang.String value)
          Adds an attribute and updates its parent reference.
 AxisMoreIter attributes()
          Returns an attribute axis iterator.
 byte[] baseURI()
          Returns the base URI of the node.
 AxisMoreIter children()
          Returns a child axis iterator.
 FElem copy()
          Creates a copy of this node.
 FElem declareNS()
          Adds a namespace declaration for the namespace in the given QName.
 boolean hasChildren()
          Returns true if the node has children.
 byte[] name()
          Returns the name of the node, composed of an optional prefix and the local name.
 Atts namespaces()
          Returns all namespaces defined for the nodes.
 FElem optimize()
          Minimizes the memory consumption of the node.
 void plan(FElem plan)
          Creates an expression tree.
 QNm qname()
          Returns the QName of the node.
 byte[] string()
          Returns the string value.
 java.lang.String toString()
           
 
Methods inherited from class org.basex.query.value.node.FNode
ancestor, ancestorOrSelf, deepCopy, descendant, descendantOrSelf, diff, following, followingSibling, is, parent, parent, parentIter, qname
 
Methods inherited from class org.basex.query.value.node.ANode
attribute, attribute, attribute, bool, dbCopy, diff, diff, eq, finish, kind, kind, nodeType, nsScope, preceding, precedingSibling, self, string, toJava, type, uri
 
Methods inherited from class org.basex.query.value.item.Item
castErr, comparable, dbl, dec, description, ebv, equiv, flt, hash, homogeneous, input, isItem, item, itemAt, iter, iterable, itr, materialize, score, score, size, test, type, typeId, writeTo, xdmInfo
 
Methods inherited from class org.basex.query.value.Value
accept, cache, checkUp, compile, copy, count, data, exprSize, has, inline, isValue, iter, iterator, removable, serialize, value
 
Methods inherited from class org.basex.query.expr.Expr
addText, compEbv, copy, hasFreeVars, indexAccessible, indexEquivalent, inlineAll, isEmpty, isFunction, isVacuous, markTailCalls, optimize, sameAs, uses, visitAll
 
Methods inherited from class org.basex.data.ExprInfo
addPlan, addPlan, info, planAttr, planElem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FElem

public FElem(java.lang.String nm)
Convenience constructor for creating an element. All QNames that are created from the specified name will be cached.

Parameters:
nm - element name

FElem

public FElem(byte[] nm)
Convenience constructor for creating an element. All QNames that are created from the specified name will be cached.

Parameters:
nm - element name

FElem

public FElem(byte[] local,
             byte[] uri)
Convenience constructor for creating an element with a new namespace. QNames will be cached and reused.

Parameters:
local - local name
uri - namespace uri

FElem

public FElem(java.lang.String local,
             java.lang.String uri)
Convenience constructor for creating an element with a new namespace. QNames will be cached and reused.

Parameters:
local - local name
uri - namespace uri

FElem

public FElem(java.lang.String prefix,
             java.lang.String local,
             java.lang.String uri)
Convenience constructor for creating an element with a new namespace. QNames will be cached and reused.

Parameters:
prefix - prefix (a default namespace will be created if the string is empty)
local - local name
uri - namespace uri

FElem

public FElem(byte[] prefix,
             byte[] local,
             byte[] uri)
Convenience constructor for creating an element with a new namespace. QNames will be cached and reused.

Parameters:
prefix - prefix (a default namespace will be created if the string is empty)
local - local name
uri - namespace uri

FElem

public FElem(QNm n)
Constructor for creating an element.

Parameters:
n - element name

FElem

public FElem(QNm nm,
             Atts nsp,
             ANodeList ch,
             ANodeList at)
Constructor for creating an element with nodes, attributes and namespace declarations.

Parameters:
nm - element name
nsp - namespaces; can be null
ch - children; can be null
at - attributes; can be null

FElem

public FElem(org.w3c.dom.Element elem,
             ANode p,
             TokenMap nss)
Constructor for creating an element from a DOM node. Originally provided by Erdal Karaca.

Parameters:
elem - DOM node
p - parent reference
nss - namespaces in scope
Method Detail

optimize

public FElem optimize()
Description copied from class: ANode
Minimizes the memory consumption of the node.

Overrides:
optimize in class ANode
Returns:
self reference

declareNS

public FElem declareNS()
Adds a namespace declaration for the namespace in the given QName.

Returns:
self reference

add

public FElem add(ANode node)
Adds a node and updates its parent reference.

Parameters:
node - node to be added
Returns:
self reference

add

public FElem add(java.lang.String nm,
                 java.lang.String value)
Adds an attribute and updates its parent reference.

Parameters:
nm - attribute name
value - attribute value
Returns:
self reference

add

public FElem add(byte[] nm,
                 java.lang.String value)
Adds an attribute and updates its parent reference.

Parameters:
nm - attribute name
value - attribute value
Returns:
self reference

add

public FElem add(java.lang.String nm,
                 byte[] value)
Adds an attribute and updates its parent reference.

Parameters:
nm - attribute name
value - attribute value
Returns:
self reference

add

public FElem add(byte[] nm,
                 byte[] value)
Adds an attribute and updates its parent reference.

Parameters:
nm - attribute name
value - attribute value
Returns:
self reference

add

public FElem add(QNm nm,
                 java.lang.String value)
Adds an attribute and updates its parent reference.

Parameters:
nm - attribute name
value - attribute value
Returns:
self reference

add

public FElem add(QNm nm,
                 byte[] value)
Adds an attribute and updates its parent reference.

Parameters:
nm - attribute name
value - attribute value
Returns:
self reference

add

public FElem add(java.lang.String text)
Creates and adds a text node if the specified value is not empty. Converts the specified string to a token and calls add(byte[]).

Parameters:
text - value of text node
Returns:
self reference

add

public FElem add(byte[] text)
Creates and adds a text node if the specified value is not empty.

Parameters:
text - value of text node
Returns:
self reference

namespaces

public Atts namespaces()
Description copied from class: ANode
Returns all namespaces defined for the nodes. Overwritten by FElem and DBNode.

Overrides:
namespaces in class ANode
Returns:
namespace array

string

public byte[] string()
Description copied from class: ANode
Returns the string value.

Overrides:
string in class FNode
Returns:
string value

baseURI

public byte[] baseURI()
Description copied from class: ANode
Returns the base URI of the node.

Overrides:
baseURI in class ANode
Returns:
base URI

qname

public QNm qname()
Description copied from class: ANode
Returns the QName of the node. This function must only be called for elements, attributes and pi's.

Overrides:
qname in class ANode
Returns:
name

name

public byte[] name()
Description copied from class: ANode
Returns the name of the node, composed of an optional prefix and the local name. This function must only be called for element and attribute nodes. It is more efficient than calling ANode.qname(), as no QNm instance is created.

Overrides:
name in class ANode
Returns:
name

attributes

public AxisMoreIter attributes()
Description copied from class: ANode
Returns an attribute axis iterator.

Overrides:
attributes in class FNode
Returns:
iterator

children

public AxisMoreIter children()
Description copied from class: ANode
Returns a child axis iterator.

Overrides:
children in class FNode
Returns:
iterator

hasChildren

public boolean hasChildren()
Description copied from class: ANode
Returns true if the node has children.

Overrides:
hasChildren in class FNode
Returns:
result of test

copy

public FElem copy()
Description copied from class: ANode
Creates a copy of this node.

Specified by:
copy in class ANode
Returns:
copy

plan

public void plan(FElem plan)
Description copied from class: ExprInfo
Creates an expression tree.

Overrides:
plan in class Item
Parameters:
plan - root element

toString

public java.lang.String toString()
Specified by:
toString in class ExprInfo