Class FElem

All Implemented Interfaces:
Iterable<Item>

public final class FElem extends FNode
Element node fragment.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • FElem

      public FElem(String name)
      Convenience constructor for creating an element.
      Parameters:
      name - element name
    • FElem

      public FElem(byte[] name)
      Convenience constructor for creating an element.
      Parameters:
      name - element name
    • FElem

      public FElem(byte[] local, byte[] uri)
      Convenience constructor for creating an element with a new namespace.
      Parameters:
      local - local name
      uri - namespace uri
    • FElem

      public FElem(String local, String uri)
      Convenience constructor for creating an element with a new namespace.
      Parameters:
      local - local name
      uri - namespace uri
    • FElem

      public FElem(String prefix, String local, String uri)
      Convenience constructor for creating an element with a new namespace.
      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.
      Parameters:
      prefix - prefix (a default namespace will be created if the string is empty)
      local - local name
      uri - namespace uri
    • FElem

      public FElem(QNm name)
      Constructor for creating an element.
      Parameters:
      name - element name
    • FElem

      public FElem(QNm name, Atts ns, ANodeList children, ANodeList atts)
      Constructor for creating an element with nodes, attributes and namespace declarations.
      Parameters:
      name - element name
      ns - namespaces, may be null
      children - children, may be null
      atts - attributes, may be null
    • FElem

      public FElem(Element elem, FNode parent, TokenMap nss)
      Constructor for creating an element from a DOM node. Originally provided by Erdal Karaca.
      Parameters:
      elem - DOM node
      parent - parent reference (can be null)
      nss - namespaces in scope
  • Method Details

    • 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 QName of this element.
      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(String nm, String val)
      Adds an attribute and updates its parent reference.
      Parameters:
      nm - attribute name
      val - attribute value
      Returns:
      self reference
    • add

      public FElem add(byte[] nm, String val)
      Adds an attribute and updates its parent reference.
      Parameters:
      nm - attribute name
      val - attribute value
      Returns:
      self reference
    • add

      public FElem add(String nm, byte[] val)
      Adds an attribute and updates its parent reference.
      Parameters:
      nm - attribute name
      val - attribute value
      Returns:
      self reference
    • add

      public FElem add(byte[] nm, byte[] val)
      Adds an attribute and updates its parent reference.
      Parameters:
      nm - attribute name
      val - attribute value
      Returns:
      self reference
    • add

      public FElem add(QNm nm, String val)
      Adds an attribute and updates its parent reference.
      Parameters:
      nm - attribute name
      val - attribute value
      Returns:
      self reference
    • add

      public FElem add(QNm nm, byte[] val)
      Adds an attribute and updates its parent reference.
      Parameters:
      nm - attribute name
      val - attribute value
      Returns:
      self reference
    • add

      public FElem add(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 or null
    • 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 (optional prefix, local name) of an attribute, element or processing instruction.
      Overrides:
      qname in class ANode
      Returns:
      name, or null if node has no QName
    • name

      public byte[] name()
      Description copied from class: ANode
      Returns the name (optional prefix, local name) of an attribute, element or processing instruction. This function is possibly evaluated faster than ANode.qname(), as no QNm instance may need to be created.
      Overrides:
      name in class ANode
      Returns:
      name, or null if node has no name
    • attributeIter

      public BasicNodeIter attributeIter()
      Description copied from class: ANode
      Returns a light-weight, low-level attribute axis iterator with Iter.size() and Iter.get(long) implemented. Before nodes are added to the result, they must be finalized via ANode.finish().
      Overrides:
      attributeIter in class FNode
      Returns:
      iterator
    • childIter

      public BasicNodeIter childIter()
      Description copied from class: ANode
      Returns a light-weight, low-level child axis iterator. Before nodes are added to the result, they must be finalized via ANode.finish().
      Overrides:
      childIter in class FNode
      Returns:
      iterator
    • hasChildren

      public boolean hasChildren()
      Description copied from class: ANode
      Indicates if the node has children.
      Overrides:
      hasChildren in class FNode
      Returns:
      result of test
    • materialize

      public FElem materialize(QueryContext qc, boolean copy)
      Description copied from class: Item
      Returns a materialized, context-independent version of this item.
      Specified by:
      materialize in class ANode
      Parameters:
      qc - query context (if null, process cannot be interrupted)
      copy - create full copy
      Returns:
      item copy, or null) if the item cannot be materialized
    • equals

      public boolean equals(Object obj)
      Description copied from class: Expr
      This function is e.g. called by:
      Overrides:
      equals in class FNode
    • plan

      public void plan(QueryPlan plan)
      Description copied from class: ExprInfo
      Creates a query plan.
      Overrides:
      plan in class Item
      Parameters:
      plan - expression plan
    • plan

      public void plan(QueryString qs)
      Description copied from class: ExprInfo
      Creates a query string.
      Specified by:
      plan in class ExprInfo
      Parameters:
      qs - query string builder