Package com.ribs
Class RXElement
java.lang.Object
com.ribs.RXAttribute
com.ribs.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 should do this:
for(int i=anElement.indexOf(elementName); i>=0; i=anElement.indexOf(elementName, i+1)) anElement.get(i).doThis();
Copyright (c) 2004 ReportMill Software, Inc. All Rights Reserved. Contact ReportMill <info@reportmill.com>.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionCreates a new element.protectedPrivate Constructor which uses XMLLoader inner class to load.Creates a new element with given name.Creates a new element with given name and value.
- 
Method SummaryModifier and TypeMethodDescriptionvoidadd(RXAttribute anAttribute) Adds the given attribute to this element's list of attributes.voidAdds a new attribute with the given name and boolean value.voidAdds a new attribute with the given name and float value.voidAdds a new attribute with the given name and int value.voidAdds a new attribute with the given name and Boolean value.voidAdds a new attribute with the given name using the object's toString() method.voidAdds a new attribute with the given name and string value.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.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).intReturns the number of child attributes for this element.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).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.static RXElementgetElement(Object aSource) Returns a new element hierarchy loaded from aSource (File, String path, InputStream or whatever).static StringgetError()Returns error message from Loading XML (Should really be a ThreadLocal).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.voidremove(int anIndex) Removes the child element at the given index.voidremove(RXAttribute attribute) Removes the given attribute from this elements attributes list.voidRemoves the given attribute or element by name.intsize()Returns child element list size.intReturns child element list size for child elements with given name.toString()Returns a string representation of this element (XML).voidWrites the element as an XML file to the given desination (presumably a String path or File).voidWrites the element as an XML file to the given desination (presumably a String path or File).voidwrite(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.ribs.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.
- 
RXElementPrivate Constructor which uses XMLLoader inner class to load.
 
- 
- 
Method Details- 
getElementReturns a new element hierarchy loaded from aSource (File, String path, InputStream or whatever).
- 
sizepublic int size()Returns child element list size.
- 
sizeReturns child element list size for child elements with given name.
- 
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.
- 
getAttributesReturns the list of child attributes for this element.
- 
getAttributeCountpublic int getAttributeCount()Returns the number of child attributes for this element.
- 
getAttributeReturns the specific child attribute at the given index.
- 
getAttributeReturns the specific child attribute with the given 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).
- 
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).
- 
addAdds the given attribute to this element's list of attributes.
- 
removepublic void remove(int anIndex) Removes the child element at the given index.
- 
removeRemoves the given attribute from this elements attributes list.
- 
removeRemoves the given attribute or element by name.
- 
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.
- 
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.
- 
toStringReturns a string representation of this element (XML).- Overrides:
- toStringin class- RXAttribute
 
- 
getBytespublic byte[] getBytes()Returns XML bytes for this element.
- 
writeWrites the element as an XML file to the given desination (presumably a String path or File).
- 
writeWrites the element as an XML file to the given desination (presumably a String path or File). If safely is true, it will write to a backup file then move it over.
- 
writeWrites the element to the given string buffer using the given indent level and indent string.
- 
getErrorReturns error message from Loading XML (Should really be a ThreadLocal).
 
-