Class RXElement
java.lang.Object
com.inductiveautomation.rm.archiver.RXAttribute
com.inductiveautomation.rm.archiver.RXElement
The 
RXElement class 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();- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionadd(RXAttribute anAttribute) Adds the given attribute to this element's list of attributes.Adds a new attribute with the given name and boolean value.Adds a new attribute with the given name and float value.Adds a new attribute with the given name and int value.Adds a new attribute with the given name and Boolean value.Adds a new attribute with the given name using the object's toString() method.Adds a new attribute with the given name and string value.voidAdds 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.get(int anIndex) Returns the specific child element at the given index.Returns the first child element with the given name.getAttribute(int anIndex) Returns the specific child attribute at the given index.getAttribute(String aName) Returns the specific child attribute with the given name (or null if not found).getAttributeBooleanValue(String aName) Returns the Boolean value for the given attribute name.getAttributeBooleanValue(String aName, Boolean defaultValue) Returns the Boolean value for the given attribute name (or the given default value, if name not found).booleangetAttributeBoolValue(String aName) Returns the boolean value for the given attribute name.booleangetAttributeBoolValue(String aName, boolean defaultValue) Returns the boolean value for the given attribute name (or the given default value, if name not found).getAttributeColorValue(String aName, Color defaultValue) intReturns the number of child attributes for this element.getAttributeEnumValue(String aName, Class enumClass, Enum defaultValue) Returns the Enum of a specific type for the given attribute name (or the given default value, if name not found).floatgetAttributeFloatValue(String aName) Returns the float value for the given attribute name.floatgetAttributeFloatValue(String aName, float defaultValue) Returns the float value for the given attribute name (or the given default value, if name not found).getAttributeFontValue(String aName, Font defaultValue) intgetAttributeIndex(RXAttribute anAttribute) Returns this index of the given attribute.intgetAttributeIndex(String aName) Returns the index of the attribute with the given name (or -1 if not found).intgetAttributeIntValue(String aName) Returns the int value for the given attribute name.intgetAttributeIntValue(String aName, int defaultValue) Returns the int value for the given attribute name (or the given default value, if name not found).getAttributeNumberValue(String aName) Returns the Number value for the given attribute name.getAttributeNumberValue(String aName, Number defaultValue) Returns the Number value for the given attribute name (or the given default value, if name not found).Returns the list of child attributes for this element.getAttributeValue(String aName) Returns the attribute string value for the given attribute name.getAttributeValue(String aName, 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.getElement(int anIndex) Returns the individual element at given index.static RXElementgetElement(Object aSource) Returns a new element hierarchy loaded from aSource (File, String path, InputStream or whatever).getElement(String aName) Returns the first element for a given name.intReturns the number of child elements.intgetElementCount(String aName) Returns the number of child elements with the given name.intgetElementIndex(RXElement anElement) Returns the index of the given element.intgetElementIndex(String aName, int start) Returns the index of element with given name.Returns the list of elements.getElements(String aName) Returns the list of child elements with given name.byte[]Returns the element value as bytes.booleanhasAttribute(String aName) Checks for presence of an attribute.intReturns the index of the first child element with the given name.intReturns the index of the first child element with the given name at or beyond the given index.removeAttribute(int anIndex) Removes the attribute at given index.intremoveAttribute(RXAttribute anAttribute) Removes the given attribute.removeAttribute(String aName) Removes the attribute with given name.removeElement(int anIndex) Removes element at given index.intremoveElement(RXElement anElement) Removes given element.removeElement(String aName) Removes the first element with given name and returns it.removeElements(String aName) Removes elements for given element name.voidsetValueBytes(byte[] theBytes) Sets the element value from bytes.intsize()Returns child element list size.toString()Returns a string representation of this element (XML).voidwrite(StringBuffer aSB, int indent, String indentStr) Writes the element to the given string buffer using the given indent level and indent string.protected voidwritePreamble(StringBuffer aSB, int indent, 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
- 
Constructor Details- 
RXElementpublic RXElement()Creates a new element.
- 
RXElementCreates a new element with given name.
- 
RXElementCreates a new element with given name and value.
 
- 
- 
Method Details- 
getElementReturns 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.
- 
getAttributeReturns the specific child attribute at the given index.
- 
getAttributesReturns the list of child attributes for this element.
- 
addAttributeAdds an attribute.
- 
addAttributeAdds an attribute at given index.
- 
removeAttributeRemoves the attribute at given index.
- 
removeAttributeRemoves the given attribute.
- 
removeAttributeRemoves the attribute with given name.
- 
getAttributeIndexReturns this index of the given attribute.
- 
getAttributeReturns the specific child attribute with the given name (or null if not found).
- 
getAttributeIndexReturns the index of the attribute with the given name (or -1 if not found).
- 
getElementCountpublic int getElementCount()Returns the number of child elements.
- 
getElementReturns the individual element at given index.
- 
getElementsReturns the list of elements.
- 
addElementAdds given element to elements list.
- 
addElementAdds given element to elements list at given index.
- 
removeElementRemoves element at given index.
- 
removeElementRemoves given element.
- 
getElementIndexReturns the index of the given element.
- 
getElementCountReturns the number of child elements with the given name.
- 
getElementIndexReturns the index of element with given name.
- 
getElementReturns the first element for a given name.
- 
removeElementRemoves the first element with given name and returns it.
- 
getElementsReturns the list of child elements with given name.
- 
removeElementsRemoves elements for given element name.
- 
hasAttributeChecks for presence of an attribute.
- 
getAttributeValueReturns the attribute string value for the given attribute name.
- 
getAttributeValueReturns the string value for the given attribute name (or the given default value, if name not found).
- 
getAttributeBoolValueReturns the boolean value for the given attribute name.
- 
getAttributeBoolValueReturns the boolean value for the given attribute name (or the given default value, if name not found).
- 
getAttributeBooleanValueReturns the Boolean value for the given attribute name.
- 
getAttributeBooleanValueReturns the Boolean value for the given attribute name (or the given default value, if name not found).
- 
getAttributeIntValueReturns the int value for the given attribute name.
- 
getAttributeIntValueReturns the int value for the given attribute name (or the given default value, if name not found).
- 
getAttributeColorValue
- 
getAttributeFloatValueReturns the float value for the given attribute name.
- 
getAttributeFloatValueReturns the float value for the given attribute name (or the given default value, if name not found).
- 
getAttributeNumberValueReturns the Number value for the given attribute name.
- 
getAttributeNumberValueReturns the Number value for the given attribute name (or the given default value, if name not found).
- 
getAttributeEnumValueReturns the Enum of a specific type for the given attribute name (or the given default value, if name not found).
- 
getAttributeFontValue
- 
addAdds a new attribute with the given name and string value.
- 
addAdds a new attribute with the given name using the object's toString() method.
- 
add
- 
addAdds a new attribute with the given name and boolean value.
- 
addAdds a new attribute with the given name and Boolean value.
- 
addAdds a new attribute with the given name and int value.
- 
addAdds a new attribute with the given name and float value.
- 
add
- 
sizepublic int size()Returns child element list size.
- 
getReturns the specific child element at the given index.
- 
getReturns the first child element with the given name.
- 
indexOfReturns the index of the first child element with the given name.
- 
indexOfReturns the index of the first child element with the given name at or beyond the given index.
- 
addAdds the given attribute to this element's list of attributes.
- 
addAllAdds 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.
- 
toStringReturns a string representation of this element (XML).- Overrides:
- toStringin class- RXAttribute
 
- 
getBytespublic byte[] getBytes()Returns XML bytes for this element.
- 
writeWrites the element to the given string buffer using the given indent level and indent string.
- 
writePreambleWrites the element to the given string buffer using the given indent level and indent string.
 
-