Class Xml.Tag

java.lang.Object
org.openrewrite.xml.tree.Xml.Tag
All Implemented Interfaces:
org.openrewrite.Tree, Content, Xml
Enclosing interface:
Xml

public static class Xml.Tag extends Object implements Xml, Content
  • Constructor Details

    • Tag

      public Tag()
  • Method Details

    • withPrefix

      public Xml.Tag withPrefix(String prefix)
      Specified by:
      withPrefix in interface Xml
    • getPrefix

      public String getPrefix()
      Specified by:
      getPrefix in interface Content
      Specified by:
      getPrefix in interface Xml
    • build

      public static Xml.Tag build(String tagSource)
    • withName

      public Xml.Tag withName(String name)
    • withValue

      public Xml.Tag withValue(String value)
    • getChild

      public Optional<Xml.Tag> getChild(String name)
    • getChildren

      public List<Xml.Tag> getChildren(String name)
    • getChildren

      public List<Xml.Tag> getChildren()
    • withChildValue

      public Xml.Tag withChildValue(String childName, String text)
      Locate a child tag with the given name and set its text value.
      Parameters:
      childName - The child tag to locate. This assumes there is one and only one.
      text - The text value to set.
      Returns:
      This tag.
    • getValue

      public Optional<String> getValue()
      Returns:
      If this tag's content is only character data, consider it the value.
    • getChildValue

      public Optional<String> getChildValue(String name)
      A shortcut for getChild(String) and getValue().
      Parameters:
      name - The name of the child element to look for.
      Returns:
      The character data of the first child element matching the provided name, if any.
    • getSibling

      public Optional<Xml.Tag> getSibling(String name, org.openrewrite.Cursor cursor)
    • withContent

      public Xml.Tag withContent(@Nullable @Nullable List<? extends Content> content)
    • acceptXml

      public <P> Xml acceptXml(XmlVisitor<P> v, P p)
      Specified by:
      acceptXml in interface Xml
    • toString

      public String toString()
      Overrides:
      toString in class Object