Class XMLAttributeList

java.lang.Object
edu.umd.cs.findbugs.xml.XMLAttributeList

public class XMLAttributeList extends Object
Helper class to format attributes in an XML tag.
Author:
David Hovemeyer
  • Constructor Details

    • XMLAttributeList

      public XMLAttributeList()
      Constructor. Creates an empty object.
  • Method Details

    • addAttribute

      public XMLAttributeList addAttribute(@Nonnull String name, @Nonnull String value)
      Add a single attribute name and value.
      Parameters:
      name - the attribute name
      value - the attribute value
      Returns:
      this object (so calls to addAttribute() can be chained)
    • addOptionalAttribute

      public XMLAttributeList addOptionalAttribute(@Nonnull String name, @CheckForNull String value)
      Add a single attribute name and value.
      Parameters:
      name - the attribute name
      value - the attribute value
      Returns:
      this object (so calls to addAttribute() can be chained)
    • toString

      public String toString()
      Return the attribute list as a String which can be directly output as part of an XML tag.
      Overrides:
      toString in class Object
    • iterator

      Return an Iterator over NameValuePairs.
    • getQuotedAttributeValue

      public static String getQuotedAttributeValue(@Nonnull String rawValue)
      Return a properly quoted form for an attribute value.
      Parameters:
      rawValue - the raw value of the attribute
      Returns:
      a properly quoted representation of the value