Class RXElement
- java.lang.Object
- 
- com.inductiveautomation.rm.archiver.RXAttribute
- 
- com.inductiveautomation.rm.archiver.RXElement
 
 
- 
 public class RXElement extends RXAttribute TheRXElementclass represents an XML element and simply manages a list of XML elements (recursively) and a list of attributes. It also inherrits from RXAttribute to get name and value. For the sake of efficiency, when you need to iterate over a list of elements for a given name, you can do this: for(int i=anElement.indexOf(elementName); i>=0; i=anElement.indexOf(elementName, i+1)) anElement.get(i).doThis();
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RXElementadd(RXAttribute anAttribute)Adds the given attribute to this element's list of attributes.RXElementadd(java.lang.String aName, boolean aValue)Adds a new attribute with the given name and boolean value.RXElementadd(java.lang.String aName, double aValue)Adds a new attribute with the given name and float value.RXElementadd(java.lang.String aName, int aValue)Adds a new attribute with the given name and int value.RXElementadd(java.lang.String aName, java.awt.Color color)RXElementadd(java.lang.String aName, java.awt.Font aValue)RXElementadd(java.lang.String aName, java.lang.Boolean aValue)Adds a new attribute with the given name and Boolean value.RXElementadd(java.lang.String aName, java.lang.Object aValue)Adds a new attribute with the given name using the object's toString() method.RXElementadd(java.lang.String aName, java.lang.String aValue)Adds a new attribute with the given name and string value.voidaddAll(RXElement anElement)Adds all the given child elements and attributes of given element to this element.voidaddAttribute(RXAttribute anAttribute)Adds an attribute.voidaddAttribute(RXAttribute anAttribute, int anIndex)Adds an attribute at given index.voidaddElement(RXElement anElement)Adds given element to elements list.voidaddElement(RXElement anElement, int anIndex)Adds given element to elements list at given index.RXElementget(int anIndex)Returns the specific child element at the given index.RXElementget(java.lang.String aName)Returns the first child element with the given name.RXAttributegetAttribute(int anIndex)Returns the specific child attribute at the given index.RXAttributegetAttribute(java.lang.String aName)Returns the specific child attribute with the given name (or null if not found).java.lang.BooleangetAttributeBooleanValue(java.lang.String aName)Returns the Boolean value for the given attribute name.java.lang.BooleangetAttributeBooleanValue(java.lang.String aName, java.lang.Boolean defaultValue)Returns the Boolean value for the given attribute name (or the given default value, if name not found).booleangetAttributeBoolValue(java.lang.String aName)Returns the boolean value for the given attribute name.booleangetAttributeBoolValue(java.lang.String aName, boolean defaultValue)Returns the boolean value for the given attribute name (or the given default value, if name not found).java.awt.ColorgetAttributeColorValue(java.lang.String aName, java.awt.Color defaultValue)intgetAttributeCount()Returns the number of child attributes for this element.java.lang.EnumgetAttributeEnumValue(java.lang.String aName, java.lang.Class enumClass, java.lang.Enum defaultValue)Returns the Enum of a specific type for the given attribute name (or the given default value, if name not found).floatgetAttributeFloatValue(java.lang.String aName)Returns the float value for the given attribute name.floatgetAttributeFloatValue(java.lang.String aName, float defaultValue)Returns the float value for the given attribute name (or the given default value, if name not found).java.awt.FontgetAttributeFontValue(java.lang.String aName, java.awt.Font defaultValue)intgetAttributeIndex(RXAttribute anAttribute)Returns this index of the given attribute.intgetAttributeIndex(java.lang.String aName)Returns the index of the attribute with the given name (or -1 if not found).intgetAttributeIntValue(java.lang.String aName)Returns the int value for the given attribute name.intgetAttributeIntValue(java.lang.String aName, int defaultValue)Returns the int value for the given attribute name (or the given default value, if name not found).java.lang.NumbergetAttributeNumberValue(java.lang.String aName)Returns the Number value for the given attribute name.java.lang.NumbergetAttributeNumberValue(java.lang.String aName, java.lang.Number defaultValue)Returns the Number value for the given attribute name (or the given default value, if name not found).java.util.List<RXAttribute>getAttributes()Returns the list of child attributes for this element.java.lang.StringgetAttributeValue(java.lang.String aName)Returns the attribute string value for the given attribute name.java.lang.StringgetAttributeValue(java.lang.String aName, java.lang.String defaultValue)Returns the string value for the given attribute name (or the given default value, if name not found).byte[]getBytes()Returns XML bytes for this element.RXElementgetElement(int anIndex)Returns the individual element at given index.static RXElementgetElement(java.lang.Object aSource)Returns a new element hierarchy loaded from aSource (File, String path, InputStream or whatever).RXElementgetElement(java.lang.String aName)Returns the first element for a given name.intgetElementCount()Returns the number of child elements.intgetElementCount(java.lang.String aName)Returns the number of child elements with the given name.intgetElementIndex(RXElement anElement)Returns the index of the given element.intgetElementIndex(java.lang.String aName, int start)Returns the index of element with given name.java.util.List<RXElement>getElements()Returns the list of elements.java.util.List<RXElement>getElements(java.lang.String aName)Returns the list of child elements with given name.byte[]getValueBytes()Returns the element value as bytes.booleanhasAttribute(java.lang.String aName)Checks for presence of an attribute.intindexOf(java.lang.String aName)Returns the index of the first child element with the given name.intindexOf(java.lang.String aName, int startIndex)Returns the index of the first child element with the given name at or beyond the given index.RXAttributeremoveAttribute(int anIndex)Removes the attribute at given index.intremoveAttribute(RXAttribute anAttribute)Removes the given attribute.RXAttributeremoveAttribute(java.lang.String aName)Removes the attribute with given name.RXElementremoveElement(int anIndex)Removes element at given index.intremoveElement(RXElement anElement)Removes given element.RXElementremoveElement(java.lang.String aName)Removes the first element with given name and returns it.java.util.List<RXElement>removeElements(java.lang.String aName)Removes elements for given element name.voidsetValueBytes(byte[] theBytes)Sets the element value from bytes.intsize()Returns child element list size.java.lang.StringtoString()Returns a string representation of this element (XML).voidwrite(java.lang.StringBuffer aSB, int indent, java.lang.String indentStr)Writes the element to the given string buffer using the given indent level and indent string.protected voidwritePreamble(java.lang.StringBuffer aSB, int indent, java.lang.String indentStr)Writes the element to the given string buffer using the given indent level and indent string.- 
Methods inherited from class com.inductiveautomation.rm.archiver.RXAttributegetFloatValue, getIntValue, getName, getNumberValue, getValue, setName, setValue
 
- 
 
- 
- 
- 
Method Detail- 
getElementpublic static RXElement getElement(java.lang.Object aSource) Returns a new element hierarchy loaded from aSource (File, String path, InputStream or whatever).
 - 
getAttributeCountpublic int getAttributeCount() Returns the number of child attributes for this element.
 - 
getAttributepublic RXAttribute getAttribute(int anIndex) Returns the specific child attribute at the given index.
 - 
getAttributespublic java.util.List<RXAttribute> getAttributes() Returns the list of child attributes for this element.
 - 
addAttributepublic void addAttribute(RXAttribute anAttribute) Adds an attribute.
 - 
addAttributepublic void addAttribute(RXAttribute anAttribute, int anIndex) Adds an attribute at given index.
 - 
removeAttributepublic RXAttribute removeAttribute(int anIndex) Removes the attribute at given index.
 - 
removeAttributepublic int removeAttribute(RXAttribute anAttribute) Removes the given attribute.
 - 
removeAttributepublic RXAttribute removeAttribute(java.lang.String aName) Removes the attribute with given name.
 - 
getAttributeIndexpublic int getAttributeIndex(RXAttribute anAttribute) Returns this index of the given attribute.
 - 
getAttributepublic RXAttribute getAttribute(java.lang.String aName) Returns the specific child attribute with the given name (or null if not found).
 - 
getAttributeIndexpublic int getAttributeIndex(java.lang.String aName) Returns the index of the attribute with the given name (or -1 if not found).
 - 
getElementCountpublic int getElementCount() Returns the number of child elements.
 - 
getElementpublic RXElement getElement(int anIndex) Returns the individual element at given index.
 - 
getElementspublic java.util.List<RXElement> getElements() Returns the list of elements.
 - 
addElementpublic void addElement(RXElement anElement) Adds given element to elements list.
 - 
addElementpublic void addElement(RXElement anElement, int anIndex) Adds given element to elements list at given index.
 - 
removeElementpublic RXElement removeElement(int anIndex) Removes element at given index.
 - 
removeElementpublic int removeElement(RXElement anElement) Removes given element.
 - 
getElementIndexpublic int getElementIndex(RXElement anElement) Returns the index of the given element.
 - 
getElementCountpublic int getElementCount(java.lang.String aName) Returns the number of child elements with the given name.
 - 
getElementIndexpublic int getElementIndex(java.lang.String aName, int start)Returns the index of element with given name.
 - 
getElementpublic RXElement getElement(java.lang.String aName) Returns the first element for a given name.
 - 
removeElementpublic RXElement removeElement(java.lang.String aName) Removes the first element with given name and returns it.
 - 
getElementspublic java.util.List<RXElement> getElements(java.lang.String aName) Returns the list of child elements with given name.
 - 
removeElementspublic java.util.List<RXElement> removeElements(java.lang.String aName) Removes elements for given element name.
 - 
hasAttributepublic boolean hasAttribute(java.lang.String aName) Checks for presence of an attribute.
 - 
getAttributeValuepublic java.lang.String getAttributeValue(java.lang.String aName) Returns the attribute string value for the given attribute name.
 - 
getAttributeValuepublic java.lang.String getAttributeValue(java.lang.String aName, java.lang.String defaultValue)Returns the string value for the given attribute name (or the given default value, if name not found).
 - 
getAttributeBoolValuepublic boolean getAttributeBoolValue(java.lang.String aName) Returns the boolean value for the given attribute name.
 - 
getAttributeBoolValuepublic boolean getAttributeBoolValue(java.lang.String aName, boolean defaultValue)Returns the boolean value for the given attribute name (or the given default value, if name not found).
 - 
getAttributeBooleanValuepublic java.lang.Boolean getAttributeBooleanValue(java.lang.String aName) Returns the Boolean value for the given attribute name.
 - 
getAttributeBooleanValuepublic java.lang.Boolean getAttributeBooleanValue(java.lang.String aName, java.lang.Boolean defaultValue)Returns the Boolean value for the given attribute name (or the given default value, if name not found).
 - 
getAttributeIntValuepublic int getAttributeIntValue(java.lang.String aName) Returns the int value for the given attribute name.
 - 
getAttributeIntValuepublic int getAttributeIntValue(java.lang.String aName, int defaultValue)Returns the int value for the given attribute name (or the given default value, if name not found).
 - 
getAttributeColorValuepublic java.awt.Color getAttributeColorValue(java.lang.String aName, java.awt.Color defaultValue)
 - 
getAttributeFloatValuepublic float getAttributeFloatValue(java.lang.String aName) Returns the float value for the given attribute name.
 - 
getAttributeFloatValuepublic float getAttributeFloatValue(java.lang.String aName, float defaultValue)Returns the float value for the given attribute name (or the given default value, if name not found).
 - 
getAttributeNumberValuepublic java.lang.Number getAttributeNumberValue(java.lang.String aName) Returns the Number value for the given attribute name.
 - 
getAttributeNumberValuepublic java.lang.Number getAttributeNumberValue(java.lang.String aName, java.lang.Number defaultValue)Returns the Number value for the given attribute name (or the given default value, if name not found).
 - 
getAttributeEnumValuepublic java.lang.Enum getAttributeEnumValue(java.lang.String aName, java.lang.Class enumClass, java.lang.Enum defaultValue)Returns the Enum of a specific type for the given attribute name (or the given default value, if name not found).
 - 
getAttributeFontValuepublic java.awt.Font getAttributeFontValue(java.lang.String aName, java.awt.Font defaultValue)
 - 
addpublic RXElement add(java.lang.String aName, java.lang.String aValue) Adds a new attribute with the given name and string value.
 - 
addpublic RXElement add(java.lang.String aName, java.lang.Object aValue) Adds a new attribute with the given name using the object's toString() method.
 - 
addpublic RXElement add(java.lang.String aName, java.awt.Color color) 
 - 
addpublic RXElement add(java.lang.String aName, boolean aValue) Adds a new attribute with the given name and boolean value.
 - 
addpublic RXElement add(java.lang.String aName, java.lang.Boolean aValue) Adds a new attribute with the given name and Boolean value.
 - 
addpublic RXElement add(java.lang.String aName, int aValue) Adds a new attribute with the given name and int value.
 - 
addpublic RXElement add(java.lang.String aName, double aValue) Adds a new attribute with the given name and float value.
 - 
addpublic RXElement add(java.lang.String aName, java.awt.Font aValue) 
 - 
sizepublic int size() Returns child element list size.
 - 
getpublic RXElement get(int anIndex) Returns the specific child element at the given index.
 - 
getpublic RXElement get(java.lang.String aName) Returns the first child element with the given name.
 - 
indexOfpublic int indexOf(java.lang.String aName) Returns the index of the first child element with the given name.
 - 
indexOfpublic int indexOf(java.lang.String aName, int startIndex)Returns the index of the first child element with the given name at or beyond the given index.
 - 
addpublic RXElement add(RXAttribute anAttribute) Adds the given attribute to this element's list of attributes.
 - 
addAllpublic void addAll(RXElement anElement) Adds all the given child elements and attributes of given element to this element.
 - 
getValueBytespublic byte[] getValueBytes() Returns the element value as bytes.
 - 
setValueBytespublic void setValueBytes(byte[] theBytes) Sets the element value from bytes.
 - 
toStringpublic java.lang.String toString() Returns a string representation of this element (XML).- Overrides:
- toStringin class- RXAttribute
 
 - 
getBytespublic byte[] getBytes() Returns XML bytes for this element.
 - 
writepublic void write(java.lang.StringBuffer aSB, int indent, java.lang.String indentStr)Writes the element to the given string buffer using the given indent level and indent string.
 - 
writePreambleprotected void writePreamble(java.lang.StringBuffer aSB, int indent, java.lang.String indentStr)Writes the element to the given string buffer using the given indent level and indent string.
 
- 
 
-