Class XMLAttrVector


  • public class XMLAttrVector
    extends java.lang.Object
    XMLAttrVector is an class which assists in writing XML attributes to a stream.
    • Constructor Summary

      Constructors 
      Constructor Description
      XMLAttrVector()
      Construct an empty XMLAttrVector.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      XMLAttrVector add​(java.lang.String attrName, boolean attrVal)
      Add a new attribute/value pair based on a boolean value.
      XMLAttrVector add​(java.lang.String attrName, double attrVal)
      Add a new attribute/value pair based on a double value.
      XMLAttrVector add​(java.lang.String attrName, int attrVal)
      Add a new attribute/value pair based on an int value.
      XMLAttrVector add​(java.lang.String attrName, java.lang.Object attrVal)
      Add a new attribute/value pair based on a String value.
      void display​(java.io.PrintWriter out, int indent)
      Displays the entire attribute/value pair list, given a PrintWriter to which to display and an indentation level.
      int size()
      Returns the number of attributes.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XMLAttrVector

        public XMLAttrVector()
        Construct an empty XMLAttrVector. Attribute/value pairs may be added with the add() functions below.
    • Method Detail

      • size

        public int size()
        Returns the number of attributes.
      • add

        public XMLAttrVector add​(java.lang.String attrName,
                                 java.lang.Object attrVal)
        Add a new attribute/value pair based on a String value. Note that attrVal may be null, in which case no attribute/value pair is added.
        Parameters:
        attrName - the name of the attribute.
        attrVal - the String value of the attribute.
        Returns:
        this (to allow chaining)
      • add

        public XMLAttrVector add​(java.lang.String attrName,
                                 int attrVal)
        Add a new attribute/value pair based on an int value.
        Parameters:
        attrName - the name of the attribute.
        attrVal - the int value of the attribute.
        Returns:
        this (to allow chaining)
      • add

        public XMLAttrVector add​(java.lang.String attrName,
                                 double attrVal)
        Add a new attribute/value pair based on a double value.
        Parameters:
        attrName - the name of the attribute.
        attrVal - the double value of the attribute.
        Returns:
        this (to allow chaining)
      • add

        public XMLAttrVector add​(java.lang.String attrName,
                                 boolean attrVal)
        Add a new attribute/value pair based on a boolean value. True is represented as "true", and false as "false".
        Parameters:
        attrName - the name of the attribute.
        attrVal - the boolean value of the attribute.
        Returns:
        this (to allow chaining)
      • display

        public void display​(java.io.PrintWriter out,
                            int indent)
        Displays the entire attribute/value pair list, given a PrintWriter to which to display and an indentation level. This function is typically called from XMLOutput.
        Parameters:
        out - PrintWriter to which to write output.
        indent - indentation level.