Class LElement

All Implemented Interfaces:
LItem

public final class LElement extends LParent
An element, stored as the pieces of its source text: name, attributes (each with its own spacing and quotes), the whitespace before > or />, children and the exact end tag.
  • Constructor Details

    • LElement

      public LElement(String name, String startTagTail, boolean selfClosing, String endTag)
  • Method Details

    • name

      public String name()
    • prefix

      public String prefix()
    • localName

      public String localName()
    • attributes

      public List<LAttribute> attributes()
    • attribute

      public Optional<LAttribute> attribute(String qname)
    • addAttribute

      public void addAttribute(LAttribute attribute)
    • removeAttribute

      public void removeAttribute(LAttribute attribute)
    • startTagTail

      public String startTagTail()
      Whitespace between the last attribute (or the name) and > / />.
    • selfClosing

      public boolean selfClosing()
    • setSelfClosing

      public void setSelfClosing(boolean selfClosing)
      Switches between <a/> and <a></a>. Opening a self-closing element drops whitespace before /> unless it contains a line break (multi-line start tags keep their layout).
    • endTag

      public String endTag()
      The exact end tag (e.g. </a >), or null for a self-closing element.
    • setEndTag

      public void setEndTag(String endTag)
    • namespaceUri

      public String namespaceUri(String prefix)
      Resolves a namespace prefix ("" for the default namespace) using the declarations in scope.
      Returns:
      the URI, "" for "no namespace", or null when the prefix is not declared
    • write

      public void write(StringBuilder out)
      Specified by:
      write in class LNode