Class Element

    • Field Detail

      • startToken

        private Token startToken
      • beginName

        private java.lang.String beginName
      • postSpace

        private java.lang.String postSpace
      • endName

        private java.lang.String endName
      • name

        private java.lang.String name
      • parent

        private Parent parent
      • attributeMap

        private java.util.Map<java.lang.String,​Attribute> attributeMap
      • compactEmpty

        private boolean compactEmpty
    • Constructor Detail

      • Element

        public Element​(Token token)
      • Element

        public Element​(java.lang.String name)
      • Element

        public Element​(Parent parent,
                       java.lang.String name)
      • Element

        public Element​(java.lang.String name,
                       Namespace ns)
      • Element

        public Element​(Parent parent,
                       java.lang.String name,
                       Namespace ns)
    • Method Detail

      • getStartToken

        public Token getStartToken()
      • getStartOffset

        public int getStartOffset()
      • getEndOffset

        public int getEndOffset()
      • getBeginName

        public java.lang.String getBeginName()
      • setBeginName

        public Element setBeginName​(java.lang.String beginName)
      • getEndName

        public java.lang.String getEndName()
      • setEndName

        public Element setEndName​(java.lang.String endName)
        The string to be put into the end tag. This can contain whitespace around the name
      • getPostSpace

        public java.lang.String getPostSpace()
        Space before the closing bracket of the element
      • setPostSpace

        public Element setPostSpace​(java.lang.String postSpace)
      • setName

        public Element setName​(java.lang.String name)
      • getName

        public java.lang.String getName()
      • getParent

        public Parent getParent()
        Description copied from interface: Child
        The parent of this child
        Specified by:
        getParent in interface Child
      • setParent

        public Element setParent​(Parent parent)
        Description copied from interface: Child
        Change the parent of this child.

        CAUTION: If the child is already attached to a parent, this call will not detach the old relation! You must call child.getParent().removeNode (child), first!

        Specified by:
        setParent in interface Child
      • addAttribute

        public Element addAttribute​(java.lang.String name,
                                    java.lang.String value)
      • getAttributes

        public java.util.List<Attribute> getAttributes()
      • getAttributeMap

        public java.util.Map<java.lang.String,​Attribute> getAttributeMap()
      • getAttribute

        public Attribute getAttribute​(java.lang.String name)
      • setAttribute

        public Element setAttribute​(java.lang.String name,
                                    java.lang.String value)
      • setAttribute

        public Element setAttribute​(java.lang.String name,
                                    java.lang.String value,
                                    Namespace ns)
      • checkMandatoryAttribute

        public Element checkMandatoryAttribute​(java.lang.String name)
      • removeAttribute

        public Element removeAttribute​(java.lang.String name)
      • getAttributeValue

        public java.lang.String getAttributeValue​(java.lang.String name)
      • getAttributeValue

        public java.lang.String getAttributeValue​(java.lang.String name,
                                                  Namespace ns)
      • setCompactEmpty

        public Element setCompactEmpty​(boolean compactEmpty)
      • isCompactEmpty

        public boolean isCompactEmpty()
      • toXML

        public Element toXML​(XMLWriter writer)
                      throws java.io.IOException
        Description copied from interface: Node
        Fast way to convert many nodes to XML
        Specified by:
        toXML in interface Node
        Overrides:
        toXML in class NodeWithChildren
        Throws:
        java.io.IOException
      • getChild

        public Element getChild​(int index)
      • hasChildren

        public boolean hasChildren()
      • getChildren

        public java.util.List<Element> getChildren()
      • getChildren

        public java.util.List<Element> getChildren​(java.lang.String name)
      • getChildren

        public java.util.List<Element> getChildren​(java.lang.String name,
                                                   Namespace ns)
      • clearChildNodes

        public Element clearChildNodes()
        Deprecated.
        Use Element.clearChildren() instead
      • clearChildren

        public Element clearChildren()
      • getText

        public java.lang.String getText()
        Description copied from interface: TextNode
        Get the text from the node
        Specified by:
        getText in interface TextNode
      • getTrimmedText

        public java.lang.String getTrimmedText()
      • getNormalizedText

        public java.lang.String getNormalizedText()
      • setText

        public Element setText​(java.lang.String text)
        Description copied from interface: TextNode
        Change the text of the node. When necessary, the text will be escaped before writing it to the output stream.
        Specified by:
        setText in interface TextNode
      • clearText

        public Element clearText()
      • getParentElement

        public Element getParentElement()
      • getNodePath

        public java.lang.String getNodePath()
        Deprecated.
        Use Element.getChildPath() instead
        Description copied from interface: Child
        Return a path which uniquely describes this child.
        Specified by:
        getNodePath in interface Child
      • getChildPath

        public java.lang.String getChildPath()
      • childIndexOf

        public int childIndexOf​(Element element)
      • getDocument

        public Document getDocument()
      • getChild

        public Element getChild​(java.lang.String path)
        Description copied from interface: Parent
        Find a child element (not a node!) by path
        Specified by:
        getChild in interface Parent
      • createClone

        public Element createClone()
        Description copied from interface: Node
        Simulate clone()
        Specified by:
        createClone in interface Node
      • setNamespace

        public void setNamespace​(Namespace namespace)
      • getNamespace

        public Namespace getNamespace()
      • remove

        public void remove()
        Specified by:
        remove in interface Child