hmi.xml
Class XMLStructureAdapter

java.lang.Object
  extended by hmi.xml.XMLStructureAdapter
All Implemented Interfaces:
XMLStructure
Direct Known Subclasses:
BMLElement, BMLTInterruptSpec, BMLTParameter, ColladaElement, CollisionModel, CompoundController, ConfigList, Deformer, EndEffector, EyePair, Face, FaceBinding, FaceUnitAssembler, FaceUnitParameter, FaceUnitParameterDefault, FaceUnitSpec, FaceUnitSpecConstraint, FaceUnitSpecConstraints, FACSConfiguration, FBParameterDefaults, FBParameterMap, GestureBinding, GLHead, GMaterial, GMesh, GNode, GScene, GShape, GSkin, GTexture, IDBranchAssembler, IDSegmentAssembler, Keyframe, Keyframes, KeyPosition, MixedSystemAssembler, MotionUnitAssembler, MotionUnitParameter, MotionUnitParameterDefault, MotionUnitSpec, MotionUnitSpecConstraint, MotionUnitSpecConstraints, MPEG4Configuration, Parameter, ParameterDefaults, ParameterMap, PhysicalHumanoidAssembler, PhysicalSegmentAssembler, ProcAnimationMU, Rotation, Skeleton, Skeleton.VJointXML, SkeletonInterpolator, SkeletonPose, SpecLoader, SpeechBehaviour.SpeechText, SpeechBinding, VertexAttribute, VertexWeights, VirtualHumanSpec, VisemeToMorphMapping, VisimeSpec, VJoint, XMLBMLExceptionFeedback, XMLBMLPerformanceStartFeedback, XMLBMLPerformanceStopFeedback, XMLBMLSyncPointProgressFeedback, XMLBMLTPlanningFinishedFeedback, XMLBMLTPlanningStartFeedback, XMLBMLWarningFeedback, XMLController, XMLPhonemeToVisemeMapping

public class XMLStructureAdapter
extends Object
implements XMLStructure

XMLStructureAdapter is an implementation of XMLStructure that is intended to be a base class that must be extended. There are two different approaches: The FIRST APPROACH is to re-implement the methods

The remaining XMLStructure methods in XMLStructureAdapter are already implemented, in XMLStructureAdapter, and are expressed in terms of these three methods.
The SECOND APPROACH uses the fact that even readXML and appendXML already have default implementations in XMLStructureAdapter, that build on top of a few even simpler methods. So, rather than re-implementing readXML and appendXML, it is often easier to reimplement those more basic methods. (getXMLTag must still be implemented); With this second approach one should (re-)implement the following five methods: The XML tag is some String that identifies (uniquely) the class that you are implementing, and that extends XMLStructureAdapter. The deafult choice would be to take the full qualified classname, that is, the class name prefixed with the package name. The alternative is to use a short string, like the class name without the package, and ensure that your class is truly unique. The XMLStructureAdapter assume that your XML tag can be obtained by calling the getXMLTag method, so you should reimplement this method. The standard way to do this is the following piece of code:
private static final String XMLTAG = "your-tag";
public String getXMLTag() { return XMLTAG; }
public static String xmlTag() { return XMLTAG; }
Unfortunately, you have to copy the code for getXMLTag again for every class, because XMLTag is a static field, and so, the default getXMLTag() always returns "XMLStructureAdapter", since it ignores your XMLTAG, and uses the default XMLTAG instead. Description of the remaining methods: Note: Although not required at all by the XMLStructure interface, it is often desirable to register an XMLStructureAdapter class with the global XML class. This guarantees that instances can be recreated from XML code, even when the precise type is not known on forehand, provided that the XML tag is enough to determine the corresponding Java Class. This is done conveniently in a static code block, as follows:
static { XML.addClass(XMLTAG, fullclassname.class); },
where "fullclassname" is the full Class name, including the package prefix.

Author:
Job Zwiers

Field Summary
static String ATTRIBUTE_TOKEN_DELIMITERS
           
static String COMMA_SEPARATOR
           
private static boolean consoleAttributeEnabled
           
static int DECODEDARRAYSIZE
           
static boolean DEFAULT_RECOVER_MODE
          The default-default recovery mode.
private static Logger logger
           
private static StringBuilder lotsOfSpaces
           
private static String NAMESPACE
           
private static String NamespaceLabel
           
static String NEWLINE
           
private  boolean recover
           
private static boolean recoverMode
           
static String SYSTEMNEWLINE
           
static int TAB
           
static String TAB_STRING
           
private  int tagLine
           
private static String XMLTAG
           
 
Constructor Summary
XMLStructureAdapter()
           
 
Method Summary
static StringBuilder appendAttribute(StringBuilder buf, String attrName, boolean boolValue)
          appends an attribute of the form name="value"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, boolean[] bools, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an attribute of the form name="value0 value1
static StringBuilder appendAttribute(StringBuilder buf, String attrName, boolean boolValue1, boolean boolValue2)
          appends an attribute of the form name="value1 value2"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, boolean boolValue1, boolean boolValue2, boolean boolValue3)
          appends an attribute of the form name="value1 value2 value3"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, boolean boolValue1, boolean boolValue2, boolean boolValue3, boolean boolValue4)
          appends an attribute of the form name="value1 value2 value3 value4"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, double doubleValue)
          appends an attribute of the form name="value"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, double[] doubles, char separator)
          appends an attribute of the form name="valu0 value1 ....."
static StringBuilder appendAttribute(StringBuilder buf, String attrName, double doubleValue1, double doubleValue2)
          appends an attribute of the form name="value1 value2"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, double doubleValue1, double doubleValue2, double doubleValue3)
          appends an attribute of the form name="value1 value2 value3"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, double doubleValue1, double doubleValue2, double doubleValue3, double doubleValue4)
          appends an attribute of the form name="value1 value2 value3 value4"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, float floatValue)
          appends an attribute of the form name="value"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, float[] floats, char separator)
          appends an attribute of the form name="value0 value1 ....."
static StringBuilder appendAttribute(StringBuilder buf, String attrName, float[] floats, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an attribute of the form name="value0 value1
static StringBuilder appendAttribute(StringBuilder buf, String attrName, float floatValue1, float floatValue2)
          appends an attribute of the form name="value1 value2"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, float floatValue1, float floatValue2, float floatValue3)
          appends an attribute of the form name="value1 value2 value3"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, float floatValue1, float floatValue2, float floatValue3, float floatValue4)
          appends an attribute of the form name="value1 value2 value3 value4"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, int intValue)
          appends an attribute of the form name="value".
static StringBuilder appendAttribute(StringBuilder buf, String attrName, int[] ints, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an attribute of the form name="valu0 value1 ....."
static StringBuilder appendAttribute(StringBuilder buf, String attrName, int intValue1, int intValue2)
          appends an attribute of the form name="value1 value2"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, int intValue1, int intValue2, int intValue3)
          appends an attribute of the form name="value1 value2 value3"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, int intValue1, int intValue2, int intValue3, int intValue4)
          appends an attribute of the form name="value1 value2 value3 value4"
static StringBuilder appendAttribute(StringBuilder buf, String attrName, long longValue)
          appends an attribute of the form name="value".
static StringBuilder appendAttribute(StringBuilder buf, String attrName, long longValue1, long longValue2)
          appends an attribute of the form name="value1 value2".
static StringBuilder appendAttribute(StringBuilder buf, String attrName, long longValue1, long longValue2, long longValue3)
          appends an attribute of the form name="value1 value2 value3".
static StringBuilder appendAttribute(StringBuilder buf, String attrName, long longValue1, long longValue2, long longValue3, long longValue4)
          appends an attribute of the form name="value1 value2 value3 value4".
static StringBuilder appendAttribute(StringBuilder buf, String attrName, String attrValue)
          This method appends a single XML style attribute to buf.
static StringBuilder appendAttribute(StringBuilder buf, String attrName, String[] strings, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an attribute of the form name="value0 value1
static StringBuilder appendAttribute(StringBuilder buf, String attrName, String attrValue1, String attrValue2)
          This method appends a single XML style attribute to buf.
static StringBuilder appendAttribute(StringBuilder buf, String attrName, String attrValue1, String attrValue2, String attrValue3)
          This method appends a single XML style attribute to buf.
static StringBuilder appendAttribute(StringBuilder buf, String attrName, String attrValue1, String attrValue2, String attrValue3, String attrValue4)
          This method appends a single XML style attribute to buf.
 StringBuilder appendAttributes(StringBuilder buf)
           
static StringBuilder appendAttributes(StringBuilder buf, HashMap attributes)
          This method appends XML style tag attributes to buf.
 StringBuilder appendAttributeString(StringBuilder buf)
          Appends a String to buf that encodes the attributes for the XML encoding.
 StringBuilder appendAttributeString(StringBuilder buf, XMLFormatting fmt)
          A special case of appendAttributeString that also takes a fmt parameter.
static StringBuilder appendBooleans(StringBuilder buf, boolean[] bools, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an array of floats, with maxNrOfElements booleans at one line.
static StringBuilder appendCloseEmptyTag(StringBuilder buf)
          Appends />
static StringBuilder appendCloseSTag(StringBuilder buf)
          Appends > (Closing an STag)
static StringBuilder appendComment(StringBuilder buf, String comment)
          appends an XML comment string to buf, The string appended is of the form: <!
 StringBuilder appendContent(StringBuilder buf)
          Appends a String to buf that encodes the contents for the XML encoding.
 StringBuilder appendContent(StringBuilder buf, XMLFormatting fmt)
          Appends a String to buf that encodes the contents for the XML encoding.
static StringBuilder appendDoubleElement(StringBuilder buf, String tagName, double value, XMLFormatting fmt)
          appends an XML element of the form "tagName"value"/tagName"
static StringBuilder appendEmptyTag(StringBuilder buf, String tagName)
          This method appends an "empty element" XML STag with specified tag name to buf.
static StringBuilder appendEmptyTag(StringBuilder buf, String tagName, HashMap attributes)
          This method appends an "empty element" XML STag with specified tag name to buf.
static StringBuilder appendEmptyTag(StringBuilder buf, XMLFormatting fmt, String tagName, HashMap attributes)
          This method appends an "empty element" XML STag with specified tag name to buf.
static StringBuilder appendEmptyTag(StringBuilder buf, XMLFormatting fmt, String tagName, String attrName, String attrValue)
          This method appends an "empty element" XML STag with specified tag name to buf.
static StringBuilder appendEmptyTag(StringBuilder buf, XMLFormatting fmt, String tagName, String attrName1, String attrValue1, String attrName2, String attrValue2)
          This method appends an "empty element" XML STag with specified tag name to buf.
static StringBuilder appendEmptyTag(StringBuilder buf, XMLFormatting fmt, String tagName, String attrName1, String attrValue1, String attrName2, String attrValue2, String attrName3, String attrValue3)
          This method appends an "empty element" XML STag with specified tag name to buf.
static StringBuilder appendETag(StringBuilder buf, String tagName)
          appends an XML ETag to buf
static StringBuilder appendETag(StringBuilder buf, String tagName, XMLFormatting fmt)
          appends an XML ETag to buf, on a new line, preceded by tab spaces.
static StringBuilder appendFloatArrayElement(StringBuilder buf, String tagName, float[] values, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an XML element of the form "tagName"value"/tagName"
static StringBuilder appendFloatElement(StringBuilder buf, String tagName, float value, XMLFormatting fmt)
          appends an XML element of the form "tagName"value"/tagName"
static StringBuilder appendFloats(StringBuilder buf, float[] floats, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an array of floats, with maxNrOfElements floats at one line.
static StringBuilder appendIntArrayElement(StringBuilder buf, String tagName, int[] values, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an XML element of the form "tagName"value"/tagName"
static StringBuilder appendIntElement(StringBuilder buf, String tagName, int value, XMLFormatting fmt)
          appends an XML element of the form "tagName"value"/tagName"
static StringBuilder appendInts(StringBuilder buf, int[] ints, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an array of ints, with maxNrOfElements ints at one line.
static StringBuilder appendLongElement(StringBuilder buf, String tagName, long value, XMLFormatting fmt)
          appends an XML element of the form "tagName"value"/tagName"
static StringBuilder appendNewLine(StringBuilder buf)
           
static StringBuilder appendNewLine(StringBuilder buf, int tab)
           
static StringBuilder appendNewLine(StringBuilder buf, XMLFormatting fmt)
           
static StringBuilder appendOpenSTag(StringBuilder buf, String tagName)
          This method appends an XML open-STag with specified tag name to buf.
static StringBuilder appendOptionalDoubleElement(StringBuilder buf, String tagName, double value, double unspecified, XMLFormatting fmt)
          appends an XML element of the form "tagName"value"/tagName", provided that value is not the special "unspecified" value.
static StringBuilder appendOptionalFloatElement(StringBuilder buf, String tagName, float value, float unspecified, XMLFormatting fmt)
          appends an XML element of the form "tagName"value"/tagName", provided that value is not the special "unspecified" value.
static StringBuilder appendOptionalIntElement(StringBuilder buf, String tagName, int value, int unspecified, XMLFormatting fmt)
          appends an XML element of the form "tagName"value"/tagName", provided that value is not the special "unspecified" value.
static StringBuilder appendOptionalLongElement(StringBuilder buf, String tagName, long value, long unspecified, XMLFormatting fmt)
          appends an XML element of the form "tagName"value"/tagName", provided that value is not the special "unspecified" value.
static StringBuilder appendSpaces(StringBuilder buf, int tab)
          appends a String consisting of exactly "tab" spaces.
static StringBuilder appendSpaces(StringBuilder buf, XMLFormatting fmt)
          appends a String consisting of exactly "tab" spaces.
static StringBuilder appendSTag(StringBuilder buf, String tagName)
          This method appends an XML STag with specified tag name to buf.
static StringBuilder appendSTag(StringBuilder buf, String tagName, HashMap attributes)
          This method appends an XML STag with specified tag name and attributes to buf.
static StringBuilder appendSTag(StringBuilder buf, String tagName, XMLFormatting fmt)
          This method appends an XML STag with specified tag name to buf.
static StringBuilder appendStringArrayElement(StringBuilder buf, String tagName, String[] values, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an XML element of the form "tagName"value"/tagName"
static StringBuilder appendStrings(StringBuilder buf, String[] strings, char separator, XMLFormatting fmt, int nrElementsPerLine)
          appends an array of strings, with maxNrOfElements floats at one line.
static StringBuilder appendSystemNewLine(StringBuilder buf)
           
static StringBuilder appendTab(StringBuilder buf)
          appends a String consisting of the amount of spaces for a "Tab".
static StringBuilder appendTextElement(StringBuilder buf, String tagName, String value, XMLFormatting fmt)
          appends an XML element of the form "tagName"value"/tagName" The value parameter is allowed to be null, and in this case, nothing is appended at all.
 StringBuilder appendXML(StringBuilder buf)
          like writeXML(PrintWriter), except that the XML encoding is appended to a StringBuilder.
 StringBuilder appendXML(StringBuilder buf, int tab)
          like writeXML(PrintWriter ,int), except that the XML encoding is appended to a StringBuilder.
 StringBuilder appendXML(StringBuilder buf, XMLFormatting fmt)
          like writeXML(PrintWriter ,int), except that the XML encoding is appended to a StringBuilder.
 StringBuilder appendXML(StringBuilder buf, XMLFormatting fmt, String prefix, String namespace)
          like writeXML(PrintWriter ,int), except that the XML encoding is appended to a StringBuilder.
 StringBuilder appendXML(StringBuilder buf, XMLFormatting fmt, XMLNameSpace xmlNamespace)
          like writeXML(PrintWriter ,int), except that the XML encoding is appended to a StringBuilder.
 StringBuilder appendXMLStructure(StringBuilder buf, XMLFormatting fmt, XMLStructure xmlStruct)
          If xmlStruct !
static
<T extends XMLStructure>
StringBuilder
appendXMLStructureList(StringBuilder buf, XMLFormatting fmt, List<T> elements)
          appends a list of XMLStructures.
static StringBuilder appendXMLTextElementList(StringBuilder buf, XMLFormatting fmt, String tagName, List<String> elements)
          appends a list of uniform XMLTextElements.
static int countTokens(String encoding)
          counts the number of tokens, separated by ATTRIBUTE_TOKEN_DELIMITERS characters, within a given encoding.
static int countTokens(String encoding, String delimiters)
          counts the number of tokens, separated by specified delimiter characters, within a given encoding.
 boolean decodeAttribute(String attrName, String attrValue)
          decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized.
 boolean decodeAttribute(String attrName, String attrValue, XMLTokenizer tokenizer)
          decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized.
 void decodeAttributes(HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          decodes all attributes.
static boolean decodeBoolean(String encoding)
          decodes a boolean value (true or false)
static boolean[] decodeBooleanArray(String encoding)
          decodes a int array, encoded as String of the form value0 value1 ..... value-n,
static boolean[] decodeBooleanArray(String encoding, boolean[] bools)
          equivalent to decodeBooleanArray(encoding, ints, ATTRIBUTE_TOKEN_DELIMITERS);
static boolean[] decodeBooleanArray(String encoding, boolean[] bools, String delimiters)
          decodes a int array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.
static boolean[] decodeBooleanArray(String encoding, String delimiters)
          decodes a int array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.
 void decodeContent(XMLTokenizer tokenizer)
          decodes the XML contents, i.e. the XML between the STag and ETag of the encoding.
static double decodeDouble(String encoding)
          decodes a double
static double[] decodeDoubleArray(String encoding)
          decodes a double array, encoded as String of the form value0 value1 ..... value-n
static double[] decodeDoubleArray(String encoding, double[] doubles)
          decodes a double array, encoded as String of the form value0 value1 ..... value-n The doubles array should be sufficiently large so that all tokens can be allocated, or else it should be null.
static double[] decodeDoubleArray(String encoding, double[] doubles, String delimiters)
          decodes a double array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.
static double[] decodeDoubleArray(String encoding, String delimiters)
          decodes a double array, encoded as String of the form value0 value1 ..... value-n
static float decodeFloat(String encoding)
          decodes a float
static float[] decodeFloatArray(String encoding)
          decodes a float array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.
static float[] decodeFloatArray(String encoding, float[] floats)
          equivalent to decodeFloatArray(encoding, floats, ATTRIBUTE_TOKEN_DELIMITERS); (i.e. attribute tokens have to be separated by white space)
static float[] decodeFloatArray(String encoding, float[] floats, String delimiters)
          decodes a float array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.
static float[] decodeFloatArray(String encoding, String delimiters)
          decodes a float array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.
static int decodeInt(String encoding)
          decodes an int
static int[] decodeIntArray(String encoding)
          decodes a int array, encoded as String of the form value0 value1 ..... value-n,
static int[] decodeIntArray(String encoding, int[] ints)
          equivalent to decodeIntArray(encoding, ints, ATTRIBUTE_TOKEN_DELIMITERS);
static int[] decodeIntArray(String encoding, int[] ints, String delimiters)
          decodes a int array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.
static int[] decodeIntArray(String encoding, String delimiters)
          decodes a int array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.
static long decodeLong(String encoding)
          decodes a long
static String[] decodeStringArray(String encoding)
          decodes a string array, encoded as String of the form value0 value1 ..... value-n
static String[] decodeStringArray(String encoding, String delimiters)
          decodes a String array, encoded as String of the form value0 value1 ..... value-n
static String[] decodeStringArray(String encoding, String[] strings)
          decodes a String array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.
static String[] decodeStringArray(String encoding, String[] strings, String delimiters)
          decodes a sequence of Strings, separated by specified delimiters
static
<T extends XMLStructure>
List<T>
decodeXMLStructureList(XMLTokenizer tokenizer, String tagName, Class<T> structureClass)
          decodes a list of XMLStructures, and returns a Java List.
static String decodeXMLValueElement(String tagName, XMLTokenizer tokenizer)
           
 String getNamespace()
          Returns the (full, unabbreviated) namespace string for this XMLStructure Class
 String getOptionalAttribute(String attrName, HashMap<String,String> attrMap)
          checkes whether an attribute with specified name is present, and returns its value.
 String getOptionalAttribute(String attrName, HashMap<String,String> attrMap, String defaultValue)
          checkes whether an attribute with specified name is present, and returns its value.
 boolean getOptionalBooleanAttribute(String attrName, HashMap<String,String> attrMap, boolean defaultValue)
          Like getOptionalAttribute, but with the result converted to a boolean.
 double getOptionalDoubleAttribute(String attrName, HashMap<String,String> attrMap, double defaultValue)
          Like getOptionalAttribute, but with the result converted to an double.
 float getOptionalFloatAttribute(String attrName, HashMap<String,String> attrMap, float defaultValue)
          Like getOptionalAttribute, but with the result converted to a float.
 int getOptionalIntAttribute(String attrName, HashMap<String,String> attrMap, int defaultValue)
          Like getOptionalAttribute, but with the result converted to an int.
 long getOptionalLongAttribute(String attrName, HashMap<String,String> attrMap, long defaultValue)
          Like getOptionalAttribute, but with the result converted to an long.
 String getRequiredAttribute(String attrName, HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          checkes whether an attribute with specified name is present, and returns its value.
 boolean getRequiredBooleanAttribute(String attrName, HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          Like getRequiredAttribute, but with the result converted to an boolean.
 double getRequiredDoubleAttribute(String attrName, HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          Like getRequiredAttribute, but with the result converted to an double.
 float getRequiredFloatAttribute(String attrName, HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          Like getRequiredAttribute, but with the result converted to a float.
 int getRequiredIntAttribute(String attrName, HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          Like getRequiredAttribute, but with the result converted to an int.
 long getRequiredLongAttribute(String attrName, HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          Like getRequiredAttribute, but with the result converted to an long.
 int getTagLine()
          returns line number of the start tag, if this Object has been decoded by using an XMLTokenizer.
 String getXMLTag()
          returns the XML tag that is used to encode this type of XMLStructure.
 boolean hasContent()
          returns whether the XML encoding should have an contents part, or should be an empty element tag.
static
<T extends XMLStructureAdapter>
T
parseXMLElement(Class<T> tClass, XMLTokenizer tokenizer)
           
 void postProcess(XMLTokenizer tokenizer)
          The postProcess method is called after the XML content has been parsed, and the ETag has been checked.
 void preProcess(XMLTokenizer tokenizer)
          The preProcess method is called, afetr the XML tag has been recognized, but before attributes or XML content has been parsed.
 XMLStructure readXML(Reader in)
          reconstructs this XMLStructure object by reading and parsing XML encoded text from a Reader.
 XMLStructure readXML(String s)
          reconstructs this XMLStructure object by parsing an XML encoded String s This method can throw an (unchecked) ScanException in case of incorrectly formatted XML.
 XMLStructure readXML(XMLTokenizer tokenizer)
          reconstructs this XMLStructureAdapter using an XMLTokenizer.
static void setConsoleAttributeEnabled(boolean b)
           
static void setDefaultRecoverMode(boolean defaultMode)
          Sets the default mode for recovery.
 void setRecoverMode(boolean mode)
          Sets the mode for recovery when the ETag is not found.
static String spaces(int tab)
          returns a String consisting of exactly "tab" spaces.
 String toString()
          the default toString() method returns the result of toXMLSTring()
 String toXMLString()
          yields an XML encoded String of this XMLStructure object.
 String toXMLString(int tab)
          yields an XML encoded String of this XMLStructure object.
 String toXMLString(String prefix, String namespace)
          yields an XML encoded String of this XMLStructure object.
 String toXMLString(XMLFormatting fmt)
          yields an XML encoded String of this XMLStructure object.
 String toXMLString(XMLFormatting fmt, String prefix, String namespace)
          yields an XML encoded String of this XMLStructure object.
 String toXMLString(XMLFormatting fmt, XMLNameSpace xmlNamespace)
          yields an XML encoded String of this XMLStructure object.
 void writeXML(PrintWriter out)
          The default implementation relies on appendXML()
 void writeXML(PrintWriter out, int tab)
          writes an XML encoded String to "out".
 void writeXML(PrintWriter out, XMLFormatting fmt)
          writes an XML encoded String to "out".
 void writeXML(PrintWriter out, XMLFormatting fmt, XMLNameSpace xmlNamespace)
          writes an XML encoded String to "out".
static String xmlTag()
          The XML tagname for XML encoding for this Class -- use this static method when you want to see if a given String equals the xml tag for this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_RECOVER_MODE

public static final boolean DEFAULT_RECOVER_MODE
The default-default recovery mode.

See Also:
Constant Field Values

recoverMode

private static boolean recoverMode

XMLTAG

private static final String XMLTAG

NAMESPACE

private static final String NAMESPACE

NamespaceLabel

private static String NamespaceLabel

tagLine

private int tagLine

recover

private boolean recover

logger

private static Logger logger

consoleAttributeEnabled

private static boolean consoleAttributeEnabled

lotsOfSpaces

private static StringBuilder lotsOfSpaces

TAB

public static final int TAB
See Also:
Constant Field Values

TAB_STRING

public static final String TAB_STRING
See Also:
Constant Field Values

NEWLINE

public static final String NEWLINE
See Also:
Constant Field Values

SYSTEMNEWLINE

public static final String SYSTEMNEWLINE

ATTRIBUTE_TOKEN_DELIMITERS

public static final String ATTRIBUTE_TOKEN_DELIMITERS
See Also:
Constant Field Values

COMMA_SEPARATOR

public static final String COMMA_SEPARATOR
See Also:
Constant Field Values

DECODEDARRAYSIZE

public static final int DECODEDARRAYSIZE
See Also:
Constant Field Values
Constructor Detail

XMLStructureAdapter

public XMLStructureAdapter()
Method Detail

getXMLTag

public String getXMLTag()
returns the XML tag that is used to encode this type of XMLStructure. The default returns null.

Specified by:
getXMLTag in interface XMLStructure

xmlTag

public static String xmlTag()
The XML tagname for XML encoding for this Class -- use this static method when you want to see if a given String equals the xml tag for this class. Default null.


getNamespace

public String getNamespace()
Returns the (full, unabbreviated) namespace string for this XMLStructure Class


hasContent

public boolean hasContent()
returns whether the XML encoding should have an contents part, or should be an empty element tag. This method should be overwritten if necessary in classes that inherit from XMLStructureAdapter. The default implementation returns always true.


getTagLine

public final int getTagLine()
returns line number of the start tag, if this Object has been decoded by using an XMLTokenizer. line counting starts at 1.


readXML

public XMLStructure readXML(Reader in)
                     throws IOException
reconstructs this XMLStructure object by reading and parsing XML encoded text from a Reader. This method can throw an (unchecked) ScanException in case of incorrectly formatted XML. The default implementation reads nothing.

Specified by:
readXML in interface XMLStructure
Throws:
IOException

readXML

public XMLStructure readXML(String s)
reconstructs this XMLStructure object by parsing an XML encoded String s This method can throw an (unchecked) ScanException in case of incorrectly formatted XML. Although this default implementation exploits the readXML(Tokenizer) method to implement readXML(String), it might be more efficient to reimplement the latter, as it is heavily used while decoding Messages.

Specified by:
readXML in interface XMLStructure

decodeAttribute

public boolean decodeAttribute(String attrName,
                               String attrValue)
decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized. Might throw a RuntimeException when an attribute has been recognized, but is ill formatted. MUST BE OVERWRITTEN BY IMPLEMENTATIONS.


decodeAttribute

public boolean decodeAttribute(String attrName,
                               String attrValue,
                               XMLTokenizer tokenizer)
decodes the value from an attribute value String returns true if succesful, returns false for attribute names that are not recognized. Might throw a RuntimeException when an attribute has been recognized, but is ill formatted. Moreover, an XMLTokenizer reference is available which can be queried for attributes, like getTokenLine() or getTokenCharPos(), which might be helpful to produce error messages referring to lines/positions within the XML document The default implementation simply calls decodeAttribute(attrName, attrValue) SHOUL BE OVERWRITTEN BY IMPLEMENTATIONS.


decodeContent

public void decodeContent(XMLTokenizer tokenizer)
                   throws IOException
decodes the XML contents, i.e. the XML between the STag and ETag of the encoding. MUST BE OVERWRITTEN BY IMPLEMENTATIONS.

Throws:
IOException

setDefaultRecoverMode

public static void setDefaultRecoverMode(boolean defaultMode)
Sets the default mode for recovery. That is, for all XMLStructureAdapter instances where no explicit call to setRecoverMode is made, the recovery mode will be set to the specified default recover mode. The "default" default is DEFAULT_RECOVER_MODE


setRecoverMode

public void setRecoverMode(boolean mode)
Sets the mode for recovery when the ETag is not found. When set to "true", a recovery action tries to skip tokens until the ETag is found, if possible. When this does not succeed, or when recovery mode is set to "false", an XMLScanException is thrown.


readXML

public XMLStructure readXML(XMLTokenizer tokenizer)
                     throws IOException
reconstructs this XMLStructureAdapter using an XMLTokenizer. This method can throw an (unchecked) XMLScanException in case of incorrectly formatted XML.

Specified by:
readXML in interface XMLStructure
Throws:
IOException

decodeAttributes

public void decodeAttributes(HashMap<String,String> attrMap,
                             XMLTokenizer tokenizer)
decodes all attributes. The default implementation calls decodeAttribute for every attribute in turn. The decodeAttributes method can be reimplemented when attributes must be processed in some particular order.


getRequiredAttribute

public String getRequiredAttribute(String attrName,
                                   HashMap<String,String> attrMap,
                                   XMLTokenizer tokenizer)
checkes whether an attribute with specified name is present, and returns its value. The attribute is removed from the Map. If the attribute is missing, a XMLScanException is thrown, using the error message method from the XMLTokenizer. If the tokenizer itself is null, a generic RuntimeException is thrown, rather than an XMLScanException.


getOptionalAttribute

public String getOptionalAttribute(String attrName,
                                   HashMap<String,String> attrMap)
checkes whether an attribute with specified name is present, and returns its value. The attribute is removed from the Map. The attribute is not required, so a null value can be returned


getOptionalAttribute

public String getOptionalAttribute(String attrName,
                                   HashMap<String,String> attrMap,
                                   String defaultValue)
checkes whether an attribute with specified name is present, and returns its value. In this case the attribute is also removed from the Map. The attribute is not required, and if it is not present, the specfied defaultValue is returned.


getRequiredIntAttribute

public int getRequiredIntAttribute(String attrName,
                                   HashMap<String,String> attrMap,
                                   XMLTokenizer tokenizer)
Like getRequiredAttribute, but with the result converted to an int.


getOptionalIntAttribute

public int getOptionalIntAttribute(String attrName,
                                   HashMap<String,String> attrMap,
                                   int defaultValue)
Like getOptionalAttribute, but with the result converted to an int.


getRequiredLongAttribute

public long getRequiredLongAttribute(String attrName,
                                     HashMap<String,String> attrMap,
                                     XMLTokenizer tokenizer)
Like getRequiredAttribute, but with the result converted to an long.


getOptionalLongAttribute

public long getOptionalLongAttribute(String attrName,
                                     HashMap<String,String> attrMap,
                                     long defaultValue)
Like getOptionalAttribute, but with the result converted to an long.


getRequiredFloatAttribute

public float getRequiredFloatAttribute(String attrName,
                                       HashMap<String,String> attrMap,
                                       XMLTokenizer tokenizer)
Like getRequiredAttribute, but with the result converted to a float.


getOptionalFloatAttribute

public float getOptionalFloatAttribute(String attrName,
                                       HashMap<String,String> attrMap,
                                       float defaultValue)
Like getOptionalAttribute, but with the result converted to a float.


getRequiredDoubleAttribute

public double getRequiredDoubleAttribute(String attrName,
                                         HashMap<String,String> attrMap,
                                         XMLTokenizer tokenizer)
Like getRequiredAttribute, but with the result converted to an double.


getOptionalDoubleAttribute

public double getOptionalDoubleAttribute(String attrName,
                                         HashMap<String,String> attrMap,
                                         double defaultValue)
Like getOptionalAttribute, but with the result converted to an double.


getRequiredBooleanAttribute

public boolean getRequiredBooleanAttribute(String attrName,
                                           HashMap<String,String> attrMap,
                                           XMLTokenizer tokenizer)
Like getRequiredAttribute, but with the result converted to an boolean.


getOptionalBooleanAttribute

public boolean getOptionalBooleanAttribute(String attrName,
                                           HashMap<String,String> attrMap,
                                           boolean defaultValue)
Like getOptionalAttribute, but with the result converted to a boolean.


preProcess

public void preProcess(XMLTokenizer tokenizer)
The preProcess method is called, afetr the XML tag has been recognized, but before attributes or XML content has been parsed. The default implementation just records the tagLine;


postProcess

public void postProcess(XMLTokenizer tokenizer)
The postProcess method is called after the XML content has been parsed, and the ETag has been checked. This is the point to do some ``post processing'', after all relevant information has been collected. The default implementation does nothing.


writeXML

public final void writeXML(PrintWriter out)
The default implementation relies on appendXML()

Specified by:
writeXML in interface XMLStructure

writeXML

public final void writeXML(PrintWriter out,
                           int tab)
writes an XML encoded String to "out". The int "tab" can be used as a hint for indentation, and denotes the indentation to be applied to the XML code as a whole. This String should equal the result of toXMLString(tab). The default implementation relies on appendXML(.. tab).

Specified by:
writeXML in interface XMLStructure

writeXML

public final void writeXML(PrintWriter out,
                           XMLFormatting fmt)
writes an XML encoded String to "out". The int "tab" can be used as a hint for indentation, and denotes the indentation to be applied to the XML code as a whole. This String should equal the result of toXMLString(tab). The default implementation relies on appendXML(.. tab).

Specified by:
writeXML in interface XMLStructure

writeXML

public final void writeXML(PrintWriter out,
                           XMLFormatting fmt,
                           XMLNameSpace xmlNamespace)
writes an XML encoded String to "out". The int "tab" can be used as a hint for indentation, and denotes the indentation to be applied to the XML code as a whole. This String should equal the result of toXMLString(tab). The default implementation relies on appendXML(.. tab).


toXMLString

public final String toXMLString()
yields an XML encoded String of this XMLStructure object. The default implementation relies on appendXML()

Specified by:
toXMLString in interface XMLStructure

toXMLString

public final String toXMLString(int tab)
yields an XML encoded String of this XMLStructure object. The readXML() methods should be able to reconstruct this object from the String delivered by toXMLString(). The default implementation relies on appendXML( .., fmt)

Specified by:
toXMLString in interface XMLStructure

toXMLString

public final String toXMLString(XMLFormatting fmt)
yields an XML encoded String of this XMLStructure object. The readXML() methods should be able to reconstruct this object from the String delivered by toXMLString(). The default implementation relies on appendXML( .., fmt)

Specified by:
toXMLString in interface XMLStructure

toXMLString

public final String toXMLString(XMLFormatting fmt,
                                XMLNameSpace xmlNamespace)
yields an XML encoded String of this XMLStructure object. The readXML() methods should be able to reconstruct this object from the String delivered by toXMLString(). The default implementation relies on appendXML( .., fmt)


toXMLString

public final String toXMLString(XMLFormatting fmt,
                                String prefix,
                                String namespace)
yields an XML encoded String of this XMLStructure object. The readXML() methods should be able to reconstruct this object from the String delivered by toXMLString(). The default implementation relies on appendXML( .., fmt)


toXMLString

public final String toXMLString(String prefix,
                                String namespace)
yields an XML encoded String of this XMLStructure object. The readXML() methods should be able to reconstruct this object from the String delivered by toXMLString(). The default implementation relies on appendXML( .., fmt)


toString

public String toString()
the default toString() method returns the result of toXMLSTring()

Overrides:
toString in class Object

appendXML

public final StringBuilder appendXML(StringBuilder buf,
                                     int tab)
like writeXML(PrintWriter ,int), except that the XML encoding is appended to a StringBuilder. The latter must be returned. The default implementation appends nothing, and must be overwrritten by extension classes.

Specified by:
appendXML in interface XMLStructure

appendXML

public final StringBuilder appendXML(StringBuilder buf,
                                     XMLFormatting fmt,
                                     String prefix,
                                     String namespace)
like writeXML(PrintWriter ,int), except that the XML encoding is appended to a StringBuilder. The latter must be returned. The default implementation appends nothing, and must be overwrritten by extension classes.


appendXML

public final StringBuilder appendXML(StringBuilder buf,
                                     XMLFormatting fmt)
like writeXML(PrintWriter ,int), except that the XML encoding is appended to a StringBuilder. The latter must be returned. The default implementation appends nothing, and must be overwrritten by extension classes.

Specified by:
appendXML in interface XMLStructure

appendXML

public StringBuilder appendXML(StringBuilder buf,
                               XMLFormatting fmt,
                               XMLNameSpace xmlNamespace)
like writeXML(PrintWriter ,int), except that the XML encoding is appended to a StringBuilder. The latter must be returned. The default implementation appends nothing, and must be overwrritten by extension classes.


appendXML

public final StringBuilder appendXML(StringBuilder buf)
like writeXML(PrintWriter), except that the XML encoding is appended to a StringBuilder. the latter must be returned. The default implementation relies on appendXML(..., 0)

Specified by:
appendXML in interface XMLStructure

appendContent

public StringBuilder appendContent(StringBuilder buf)
Appends a String to buf that encodes the contents for the XML encoding. MUST BE OVERWRITTEN BY IMPLEMENTATIONS. (The default implementation appends nothing). The encoding should start on a new line, using indentation equal to tab. There should be no newline after the encoding.


appendContent

public StringBuilder appendContent(StringBuilder buf,
                                   XMLFormatting fmt)
Appends a String to buf that encodes the contents for the XML encoding. MUST BE OVERWRITTEN BY IMPLEMENTATIONS. (The default implementation appends nothing). The encoding should start on a new line, using indentation equal to tab. There should be no newline after the encoding.


appendAttributeString

public StringBuilder appendAttributeString(StringBuilder buf,
                                           XMLFormatting fmt)
A special case of appendAttributeString that also takes a fmt parameter. This method need not be re-implemted, unless it is desitable to layout the attributes spanning several lines. The X3D standard is an example where XML attributes are abused to store complete arrays of data; in such cases, inserting newlines between data elements is highly desirable. Of course, the new lines then should start with a proper indentation, as denoted by the fmt parameter. The default implementation simply ignores this fmt, and calls appendAttributeString(buf), i.e. without the fmt parameter, which is fine for all cases where the attributes are on the same line as the XML tag.


appendAttributeString

public StringBuilder appendAttributeString(StringBuilder buf)
Appends a String to buf that encodes the attributes for the XML encoding. When non empty, the attribute string should start with a space character. Hint: call the appendAttribute(StringBuilder buf, String attrName, String attrValue) for every relevant attribute; this takes care of the leading space as well as spaces in between the attributes) MUST BE OVERWRITTEN BY IMPLEMENTATIONS. (The default implementation appends nothing). The encoding should preferably not add newline characters.


appendAttributes

public StringBuilder appendAttributes(StringBuilder buf)

appendXMLStructure

public StringBuilder appendXMLStructure(StringBuilder buf,
                                        XMLFormatting fmt,
                                        XMLStructure xmlStruct)
If xmlStruct != null, appends the XML encoding for xmlStruct, starting on a new line If xmlStruct == null, nothing is appended.


spaces

public static final String spaces(int tab)
returns a String consisting of exactly "tab" spaces.


appendSpaces

public static final StringBuilder appendSpaces(StringBuilder buf,
                                               XMLFormatting fmt)
appends a String consisting of exactly "tab" spaces.


appendSpaces

public static final StringBuilder appendSpaces(StringBuilder buf,
                                               int tab)
appends a String consisting of exactly "tab" spaces.


appendTab

public static final StringBuilder appendTab(StringBuilder buf)
appends a String consisting of the amount of spaces for a "Tab". This amount is equal to XMLStructureAdapter.TAB;


appendComment

public static final StringBuilder appendComment(StringBuilder buf,
                                                String comment)
appends an XML comment string to buf, The string appended is of the form: <!-- comment -->


appendOpenSTag

public static final StringBuilder appendOpenSTag(StringBuilder buf,
                                                 String tagName)
This method appends an XML open-STag with specified tag name to buf. The string appended is of the form <tagName;


appendCloseSTag

public static final StringBuilder appendCloseSTag(StringBuilder buf)
Appends > (Closing an STag)


appendCloseEmptyTag

public static final StringBuilder appendCloseEmptyTag(StringBuilder buf)
Appends />


appendSTag

public static final StringBuilder appendSTag(StringBuilder buf,
                                             String tagName)
This method appends an XML STag with specified tag name to buf. The string appended is of the form <tagName> No attributes are included


appendSTag

public static final StringBuilder appendSTag(StringBuilder buf,
                                             String tagName,
                                             XMLFormatting fmt)
This method appends an XML STag with specified tag name to buf. The string appended is of the form <tagName> No attributes are included The tag is on a new line, preceded by tab spaces.


appendSTag

public static final StringBuilder appendSTag(StringBuilder buf,
                                             String tagName,
                                             HashMap attributes)
This method appends an XML STag with specified tag name and attributes to buf. It is assumed that keys and values are String typed, and that values do not contain " characters. The string appended is of the form <tagName attr_0="value_0" ... attr_n="value_n">


appendEmptyTag

public static final StringBuilder appendEmptyTag(StringBuilder buf,
                                                 String tagName)
This method appends an "empty element" XML STag with specified tag name to buf. The string appended is of the form <tagName/> No attributes are included


appendEmptyTag

public static final StringBuilder appendEmptyTag(StringBuilder buf,
                                                 XMLFormatting fmt,
                                                 String tagName,
                                                 String attrName,
                                                 String attrValue)
This method appends an "empty element" XML STag with specified tag name to buf. The string appended is of the form <tagName attr=value/> A single attribute-value pair is included


appendEmptyTag

public static final StringBuilder appendEmptyTag(StringBuilder buf,
                                                 XMLFormatting fmt,
                                                 String tagName,
                                                 String attrName1,
                                                 String attrValue1,
                                                 String attrName2,
                                                 String attrValue2)
This method appends an "empty element" XML STag with specified tag name to buf. The string appended is of the form <tagName attr=value/> A single attribute-value pair is included


appendEmptyTag

public static final StringBuilder appendEmptyTag(StringBuilder buf,
                                                 XMLFormatting fmt,
                                                 String tagName,
                                                 String attrName1,
                                                 String attrValue1,
                                                 String attrName2,
                                                 String attrValue2,
                                                 String attrName3,
                                                 String attrValue3)
This method appends an "empty element" XML STag with specified tag name to buf. The string appended is of the form <tagName attr=value/> A single attribute-value pair is included


appendEmptyTag

public static final StringBuilder appendEmptyTag(StringBuilder buf,
                                                 String tagName,
                                                 HashMap attributes)
This method appends an "empty element" XML STag with specified tag name to buf. The string appended is of the form <tagName attr_0="value_0" ... attr_n="value_n"/>


appendEmptyTag

public static final StringBuilder appendEmptyTag(StringBuilder buf,
                                                 XMLFormatting fmt,
                                                 String tagName,
                                                 HashMap attributes)
This method appends an "empty element" XML STag with specified tag name to buf. The string appended is of the form <tagName attr_0="value_0" ... attr_n="value_n"/>


appendXMLStructureList

public static final <T extends XMLStructure> StringBuilder appendXMLStructureList(StringBuilder buf,
                                                                                  XMLFormatting fmt,
                                                                                  List<T> elements)
appends a list of XMLStructures. Each List element must be an XMLStructure, and is appended on a new line, with proper indentation. There are no enclosing brackets or tags. The list is allowed to be null, and in this case, nothing is added.


decodeXMLStructureList

public static final <T extends XMLStructure> List<T> decodeXMLStructureList(XMLTokenizer tokenizer,
                                                                            String tagName,
                                                                            Class<T> structureClass)
                                                                 throws IOException
decodes a list of XMLStructures, and returns a Java List. All XMLStructures are supposed to be of the same class, and with the same XML tag.

Throws:
IOException

appendXMLTextElementList

public static final StringBuilder appendXMLTextElementList(StringBuilder buf,
                                                           XMLFormatting fmt,
                                                           String tagName,
                                                           List<String> elements)
appends a list of uniform XMLTextElements. Each List element must be a String, and is appended on a new line, as an XMLTextElement with specified tag name. The list is allowed to be null, and in this case, nothing is added.


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  String attrValue)
This method appends a single XML style attribute to buf. The string has the form : " attrName=\"attrValue\"". It is assumed that attrName is a legal XML attribute name, and that attrValue is a legal XML value, not containing " characters. The attrValue is allowed to be null, and in this case nothing is appended at all.


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  String attrValue1,
                                                  String attrValue2)
This method appends a single XML style attribute to buf. The string has the form : " attrName=\"attrValue1 attrValue2\"". It is assumed that attrName is a legal XML attribute name, and that attrValue is a legal XML value, not containing " characters.


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  String attrValue1,
                                                  String attrValue2,
                                                  String attrValue3)
This method appends a single XML style attribute to buf. The string has the form : " attrName=\"attrValue1 attrValue2 attrValue3\"". It is assumed that attrName is a legal XML attribute name, and that attrValue is a legal XML value, not containing " characters.


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  String attrValue1,
                                                  String attrValue2,
                                                  String attrValue3,
                                                  String attrValue4)
This method appends a single XML style attribute to buf. The string has the form : " attrName=\"attrValue1 attrValue2 attrValue3 attrValue4\"". It is assumed that attrName is a legal XML attribute name, and that attrValue is a legal XML value, not containing " characters.


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  int intValue)
appends an attribute of the form name="value".


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  int intValue1,
                                                  int intValue2)
appends an attribute of the form name="value1 value2"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  int intValue1,
                                                  int intValue2,
                                                  int intValue3)
appends an attribute of the form name="value1 value2 value3"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  int intValue1,
                                                  int intValue2,
                                                  int intValue3,
                                                  int intValue4)
appends an attribute of the form name="value1 value2 value3 value4"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  long longValue)
appends an attribute of the form name="value".


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  long longValue1,
                                                  long longValue2)
appends an attribute of the form name="value1 value2".


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  long longValue1,
                                                  long longValue2,
                                                  long longValue3)
appends an attribute of the form name="value1 value2 value3".


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  long longValue1,
                                                  long longValue2,
                                                  long longValue3,
                                                  long longValue4)
appends an attribute of the form name="value1 value2 value3 value4".


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  float floatValue)
appends an attribute of the form name="value"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  float floatValue1,
                                                  float floatValue2)
appends an attribute of the form name="value1 value2"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  float floatValue1,
                                                  float floatValue2,
                                                  float floatValue3)
appends an attribute of the form name="value1 value2 value3"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  float floatValue1,
                                                  float floatValue2,
                                                  float floatValue3,
                                                  float floatValue4)
appends an attribute of the form name="value1 value2 value3 value4"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  double doubleValue)
appends an attribute of the form name="value"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  double doubleValue1,
                                                  double doubleValue2)
appends an attribute of the form name="value1 value2"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  double doubleValue1,
                                                  double doubleValue2,
                                                  double doubleValue3)
appends an attribute of the form name="value1 value2 value3"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  double doubleValue1,
                                                  double doubleValue2,
                                                  double doubleValue3,
                                                  double doubleValue4)
appends an attribute of the form name="value1 value2 value3 value4"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  boolean boolValue)
appends an attribute of the form name="value"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  boolean boolValue1,
                                                  boolean boolValue2)
appends an attribute of the form name="value1 value2"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  boolean boolValue1,
                                                  boolean boolValue2,
                                                  boolean boolValue3)
appends an attribute of the form name="value1 value2 value3"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  boolean boolValue1,
                                                  boolean boolValue2,
                                                  boolean boolValue3,
                                                  boolean boolValue4)
appends an attribute of the form name="value1 value2 value3 value4"


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  int[] ints,
                                                  char separator,
                                                  XMLFormatting fmt,
                                                  int nrElementsPerLine)
appends an attribute of the form name="valu0 value1 ....." The ints array is allowed to be null, and in this case, nothing is appended at all.


appendInts

public static final StringBuilder appendInts(StringBuilder buf,
                                             int[] ints,
                                             char separator,
                                             XMLFormatting fmt,
                                             int nrElementsPerLine)
appends an array of ints, with maxNrOfElements ints at one line. The ints array is allowed to be null or empty, and in this case, nothing is appended at all.


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  float[] floats,
                                                  char separator)
appends an attribute of the form name="value0 value1 ....." The floats array is allowed to be null, and in this case, nothing is appended at all.


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  float[] floats,
                                                  char separator,
                                                  XMLFormatting fmt,
                                                  int nrElementsPerLine)
appends an attribute of the form name="value0 value1 .....", with maxNrOfElements float at one line. The floats array is allowed to be null and in this case, nothing is appended at all.


appendFloats

public static final StringBuilder appendFloats(StringBuilder buf,
                                               float[] floats,
                                               char separator,
                                               XMLFormatting fmt,
                                               int nrElementsPerLine)
appends an array of floats, with maxNrOfElements floats at one line. The floats array is allowed to be null or empty, and in this case, nothing is appended at all.


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  String[] strings,
                                                  char separator,
                                                  XMLFormatting fmt,
                                                  int nrElementsPerLine)
appends an attribute of the form name="value0 value1 .....", with maxNrOfElements Strings at one line. The strings array is allowed to be null and in this case, nothing is appended at all.


appendStrings

public static final StringBuilder appendStrings(StringBuilder buf,
                                                String[] strings,
                                                char separator,
                                                XMLFormatting fmt,
                                                int nrElementsPerLine)
appends an array of strings, with maxNrOfElements floats at one line. The strings array is allowed to be null or empty, and in this case, nothing is appended at all.


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  boolean[] bools,
                                                  char separator,
                                                  XMLFormatting fmt,
                                                  int nrElementsPerLine)
appends an attribute of the form name="value0 value1 .....", with maxNrOfElements Strings at one line. The strings array is allowed to be null and in this case, nothing is appended at all.


appendBooleans

public static final StringBuilder appendBooleans(StringBuilder buf,
                                                 boolean[] bools,
                                                 char separator,
                                                 XMLFormatting fmt,
                                                 int nrElementsPerLine)
appends an array of floats, with maxNrOfElements booleans at one line. The bools array is allowed to be null or empty, and in this case, nothing is appended at all.


appendAttribute

public static final StringBuilder appendAttribute(StringBuilder buf,
                                                  String attrName,
                                                  double[] doubles,
                                                  char separator)
appends an attribute of the form name="valu0 value1 ....." The doubles array is allowed to be null, and in this case, nothing is appended at all.


appendAttributes

public static final StringBuilder appendAttributes(StringBuilder buf,
                                                   HashMap attributes)
This method appends XML style tag attributes to buf. It is assumed that the keys and values of the attributes hashMap are String typed, and that values do not contain " characters. The attributes map is allowed to be null, and in this case, nothing is appended at all.


appendETag

public static final StringBuilder appendETag(StringBuilder buf,
                                             String tagName)
appends an XML ETag to buf


appendETag

public static final StringBuilder appendETag(StringBuilder buf,
                                             String tagName,
                                             XMLFormatting fmt)
appends an XML ETag to buf, on a new line, preceded by tab spaces.


appendSystemNewLine

public static final StringBuilder appendSystemNewLine(StringBuilder buf)

appendNewLine

public static final StringBuilder appendNewLine(StringBuilder buf)

appendNewLine

public static final StringBuilder appendNewLine(StringBuilder buf,
                                                int tab)

appendNewLine

public static final StringBuilder appendNewLine(StringBuilder buf,
                                                XMLFormatting fmt)

appendTextElement

public static final StringBuilder appendTextElement(StringBuilder buf,
                                                    String tagName,
                                                    String value,
                                                    XMLFormatting fmt)
appends an XML element of the form "tagName"value"/tagName" The value parameter is allowed to be null, and in this case, nothing is appended at all.


appendIntElement

public static final StringBuilder appendIntElement(StringBuilder buf,
                                                   String tagName,
                                                   int value,
                                                   XMLFormatting fmt)
appends an XML element of the form "tagName"value"/tagName"


appendOptionalIntElement

public static final StringBuilder appendOptionalIntElement(StringBuilder buf,
                                                           String tagName,
                                                           int value,
                                                           int unspecified,
                                                           XMLFormatting fmt)
appends an XML element of the form "tagName"value"/tagName", provided that value is not the special "unspecified" value.


appendLongElement

public static final StringBuilder appendLongElement(StringBuilder buf,
                                                    String tagName,
                                                    long value,
                                                    XMLFormatting fmt)
appends an XML element of the form "tagName"value"/tagName"


appendOptionalLongElement

public static final StringBuilder appendOptionalLongElement(StringBuilder buf,
                                                            String tagName,
                                                            long value,
                                                            long unspecified,
                                                            XMLFormatting fmt)
appends an XML element of the form "tagName"value"/tagName", provided that value is not the special "unspecified" value.


appendFloatElement

public static final StringBuilder appendFloatElement(StringBuilder buf,
                                                     String tagName,
                                                     float value,
                                                     XMLFormatting fmt)
appends an XML element of the form "tagName"value"/tagName"


appendOptionalFloatElement

public static final StringBuilder appendOptionalFloatElement(StringBuilder buf,
                                                             String tagName,
                                                             float value,
                                                             float unspecified,
                                                             XMLFormatting fmt)
appends an XML element of the form "tagName"value"/tagName", provided that value is not the special "unspecified" value.


appendDoubleElement

public static final StringBuilder appendDoubleElement(StringBuilder buf,
                                                      String tagName,
                                                      double value,
                                                      XMLFormatting fmt)
appends an XML element of the form "tagName"value"/tagName"


appendOptionalDoubleElement

public static final StringBuilder appendOptionalDoubleElement(StringBuilder buf,
                                                              String tagName,
                                                              double value,
                                                              double unspecified,
                                                              XMLFormatting fmt)
appends an XML element of the form "tagName"value"/tagName", provided that value is not the special "unspecified" value.


appendIntArrayElement

public static final StringBuilder appendIntArrayElement(StringBuilder buf,
                                                        String tagName,
                                                        int[] values,
                                                        char separator,
                                                        XMLFormatting fmt,
                                                        int nrElementsPerLine)
appends an XML element of the form "tagName"value"/tagName"


appendFloatArrayElement

public static final StringBuilder appendFloatArrayElement(StringBuilder buf,
                                                          String tagName,
                                                          float[] values,
                                                          char separator,
                                                          XMLFormatting fmt,
                                                          int nrElementsPerLine)
appends an XML element of the form "tagName"value"/tagName"


appendStringArrayElement

public static final StringBuilder appendStringArrayElement(StringBuilder buf,
                                                           String tagName,
                                                           String[] values,
                                                           char separator,
                                                           XMLFormatting fmt,
                                                           int nrElementsPerLine)
appends an XML element of the form "tagName"value"/tagName"


decodeXMLValueElement

public static final String decodeXMLValueElement(String tagName,
                                                 XMLTokenizer tokenizer)
                                          throws IOException
Throws:
IOException

decodeInt

public static final int decodeInt(String encoding)
decodes an int


decodeLong

public static final long decodeLong(String encoding)
decodes a long


decodeFloat

public static final float decodeFloat(String encoding)
decodes a float


decodeDouble

public static final double decodeDouble(String encoding)
decodes a double


decodeBoolean

public static final boolean decodeBoolean(String encoding)
decodes a boolean value (true or false)


countTokens

public static final int countTokens(String encoding,
                                    String delimiters)
counts the number of tokens, separated by specified delimiter characters, within a given encoding.


countTokens

public static final int countTokens(String encoding)
counts the number of tokens, separated by ATTRIBUTE_TOKEN_DELIMITERS characters, within a given encoding.


decodeBooleanArray

public static final boolean[] decodeBooleanArray(String encoding)
decodes a int array, encoded as String of the form value0 value1 ..... value-n,


decodeBooleanArray

public static final boolean[] decodeBooleanArray(String encoding,
                                                 String delimiters)
decodes a int array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.


decodeBooleanArray

public static final boolean[] decodeBooleanArray(String encoding,
                                                 boolean[] bools)
equivalent to decodeBooleanArray(encoding, ints, ATTRIBUTE_TOKEN_DELIMITERS);


decodeBooleanArray

public static final boolean[] decodeBooleanArray(String encoding,
                                                 boolean[] bools,
                                                 String delimiters)
decodes a int array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String. The ints array should be sufficiently large so that all tokens can be allocated, or else it should be null. In the latter case, a new int array is allocated with length equal to the number of tokens.


decodeIntArray

public static final int[] decodeIntArray(String encoding)
decodes a int array, encoded as String of the form value0 value1 ..... value-n,


decodeIntArray

public static final int[] decodeIntArray(String encoding,
                                         String delimiters)
decodes a int array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.


decodeIntArray

public static final int[] decodeIntArray(String encoding,
                                         int[] ints)
equivalent to decodeIntArray(encoding, ints, ATTRIBUTE_TOKEN_DELIMITERS);


decodeIntArray

public static final int[] decodeIntArray(String encoding,
                                         int[] ints,
                                         String delimiters)
decodes a int array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String. The ints array should be sufficiently large so that all tokens can be allocated, or else it should be null. In the latter case, a new int array is allocated with length equal to the number of tokens.


decodeFloatArray

public static final float[] decodeFloatArray(String encoding)
decodes a float array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.


decodeFloatArray

public static final float[] decodeFloatArray(String encoding,
                                             String delimiters)
decodes a float array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String.


decodeFloatArray

public static final float[] decodeFloatArray(String encoding,
                                             float[] floats)
equivalent to decodeFloatArray(encoding, floats, ATTRIBUTE_TOKEN_DELIMITERS); (i.e. attribute tokens have to be separated by white space)


decodeFloatArray

public static final float[] decodeFloatArray(String encoding,
                                             float[] floats,
                                             String delimiters)
decodes a float array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String. The floats array should be sufficiently large so that all tokens can be allocated, or else it should be null. In the latter case, a new float array is allocated with length equal to the number of tokens.


decodeDoubleArray

public static final double[] decodeDoubleArray(String encoding)
decodes a double array, encoded as String of the form value0 value1 ..... value-n


decodeDoubleArray

public static final double[] decodeDoubleArray(String encoding,
                                               String delimiters)
decodes a double array, encoded as String of the form value0 value1 ..... value-n


decodeDoubleArray

public static final double[] decodeDoubleArray(String encoding,
                                               double[] doubles)
decodes a double array, encoded as String of the form value0 value1 ..... value-n The doubles array should be sufficiently large so that all tokens can be allocated, or else it should be null. In the latter case, a new double array is allocated with length equal to the number of tokens.


decodeDoubleArray

public static final double[] decodeDoubleArray(String encoding,
                                               double[] doubles,
                                               String delimiters)
decodes a double array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String. The doubles array should be sufficiently large so that all tokens can be allocated, or else it should be null. In the latter case, a new double array is allocated with length equal to the number of tokens.


decodeStringArray

public static final String[] decodeStringArray(String encoding)
decodes a string array, encoded as String of the form value0 value1 ..... value-n


decodeStringArray

public static final String[] decodeStringArray(String encoding,
                                               String delimiters)
decodes a String array, encoded as String of the form value0 value1 ..... value-n


decodeStringArray

public static final String[] decodeStringArray(String encoding,
                                               String[] strings)
decodes a String array, encoded as String of the form value0 value1 ..... value-n, where the values are separated by characters specified by means of the delimiter String. The Strings array should be sufficiently large so that all tokens can be allocated, or else it should be null. In the latter case, a new String array is allocated with length equal to the number of tokens.


decodeStringArray

public static final String[] decodeStringArray(String encoding,
                                               String[] strings,
                                               String delimiters)
decodes a sequence of Strings, separated by specified delimiters


setConsoleAttributeEnabled

public static void setConsoleAttributeEnabled(boolean b)

parseXMLElement

public static <T extends XMLStructureAdapter> T parseXMLElement(Class<T> tClass,
                                                                XMLTokenizer tokenizer)