|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--simkin.ExecutableRoot | +--simkin.XMLElementObject
This object is a container for an XML element, and exposes an interface to it to Simkin The class implements methods from the Executable interface.
The method getValue, setValue and method all search for matching element tags within the XML document. Only the first matching tag is used.
This class supports the following fields:
Constructor Summary | |
XMLElementObject()
Default Constructor |
|
XMLElementObject(org.w3c.dom.Element elem)
Constructor which takes an Element |
Method Summary | |
void |
addElement(java.lang.String tag_name)
adds a new element with the given tag name to this element |
boolean |
containsElement(java.lang.String tag_name)
returns true if this element contains an element with the given tag name |
void |
copyAttributesInto(org.w3c.dom.Element other)
This method clears the other elements attributes and copies from ours into it |
void |
copyItemsInto(org.w3c.dom.Element other)
Clears the other element and does a deep copy of the children of this node into that one |
void |
dump()
This method writes the entire XML element out to the tracer |
XMLElementObjectEnumerator |
enumerate()
This method returns an object which can iterate over all the immediate child elements of this element |
XMLElementObjectEnumerator |
enumerate(java.lang.String tagName)
This method returns an object which can iterate over all the immediate child elements of this element whose tagname matches the one given |
boolean |
equals(java.lang.Object o)
tests for equality with another object, using the string value |
static org.w3c.dom.Element |
findChild(org.w3c.dom.Element parent,
int index)
returns the nth child element |
static org.w3c.dom.Element |
findChild(org.w3c.dom.Element parent,
java.lang.String tagname)
returns a child element |
static org.w3c.dom.Element |
findChild(org.w3c.dom.Element parent,
java.lang.String tagname,
java.lang.String attribute,
java.lang.String value)
returns a child element with the given attribute set to the given value |
java.lang.String |
getAttribute(java.lang.String name)
This method returns the value of an attribute attached to this element. |
static java.lang.String |
getData(org.w3c.dom.Element element)
retrieves the text data from an element |
org.w3c.dom.Element |
getElement()
This method returns the XML Element being held by the object. |
java.lang.Object |
getValue(java.lang.String name,
java.lang.String attrib)
Retrieves a field from the XML. |
java.lang.Object |
getValueAt(java.lang.Object array_index,
java.lang.String attrib)
Retrieves the nth child element from this element. |
java.lang.Object |
method(java.lang.String s,
java.lang.Object[] args)
this method attempts to execute a method stored in the XML. |
void |
setAttribute(java.lang.String name,
java.lang.String value)
Sets an attribute on this node |
static void |
setData(org.w3c.dom.Element element,
java.lang.String data)
sets the text data for a node by looking for the first CDATA and TEXT child node |
void |
setValue(java.lang.String name,
java.lang.String attrib,
java.lang.Object v)
sets the value of an item in the element. |
void |
setValueAt(java.lang.Object array_index,
java.lang.String attrib,
java.lang.Object v)
sets the value of an item in the element. |
java.lang.String |
tagName()
this method returns the tag name of this object (taken from the code element) |
java.lang.String |
toString()
|
Methods inherited from class simkin.ExecutableRoot |
setTracer |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public XMLElementObject()
public XMLElementObject(org.w3c.dom.Element elem)
elem
- the element to be storedMethod Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public void setValue(java.lang.String name, java.lang.String attrib, java.lang.Object v) throws java.lang.RuntimeException, java.lang.NoSuchFieldException
setValue
in class ExecutableRoot
name
- the name of the element tag to set (null if it's the overall element)attrib
- the name of the attribute to set (null to set text for the element)java.lang.RuntimeException
- - if there was a problem running the script (such as not having permission to access a field)java.lang.NoSuchFieldException
- - if the field could not be foundpublic void setValueAt(java.lang.Object array_index, java.lang.String attrib, java.lang.Object v) throws java.lang.RuntimeException
setValueAt
in class ExecutableRoot
array_index
- the position of the element in the listattrib
- the name of the attribute to set (null to set text for the element)java.lang.RuntimeException
- - if there was a problem running the scriptpublic void copyAttributesInto(org.w3c.dom.Element other)
child
- - the element into which our attributes will be copiedpublic void copyItemsInto(org.w3c.dom.Element other)
child
- - the element into which our children will be copiedpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public org.w3c.dom.Element getElement()
public java.lang.Object getValueAt(java.lang.Object array_index, java.lang.String attrib) throws java.lang.RuntimeException
getValueAt
in class ExecutableRoot
array_index
- the array indexattrib
- the attribute name to retrievejava.lang.RuntimeException
- - if there was a problem running the scriptpublic java.lang.Object getValue(java.lang.String name, java.lang.String attrib) throws java.lang.RuntimeException, java.lang.NoSuchFieldException
getValue
in class ExecutableRoot
name
- the tag name containing the dataattrib
- the attribute name to retrievejava.lang.RuntimeException
- - if there was a problem running the script (such as not having permission to access a field)java.lang.NoSuchFieldException
- - if the field could not be foundpublic static java.lang.String getData(org.w3c.dom.Element element)
element
- public static void setData(org.w3c.dom.Element element, java.lang.String data)
element
- the element to be changeddata
- the data to be setpublic static org.w3c.dom.Element findChild(org.w3c.dom.Element parent, java.lang.String tagname)
parent
- the parent elementtagname
- the tag name of the elementpublic static org.w3c.dom.Element findChild(org.w3c.dom.Element parent, int index)
parent
- the parent elementtagname
- the tag name of the elementpublic static org.w3c.dom.Element findChild(org.w3c.dom.Element parent, java.lang.String tagname, java.lang.String attribute, java.lang.String value)
parent
- the parent elementtagname
- the tag name of the elementattribute
- name of the attributevalue
- value of the named attributepublic void setAttribute(java.lang.String name, java.lang.String value)
public java.lang.String getAttribute(java.lang.String name)
public XMLElementObjectEnumerator enumerate()
public XMLElementObjectEnumerator enumerate(java.lang.String tagName)
public void dump()
public java.lang.Object method(java.lang.String s, java.lang.Object[] args) throws ParseException, java.lang.RuntimeException, java.lang.NoSuchMethodException
method
in class ExecutableRoot
s
- the name of the methodargs
- an array of arguments to the methodret
- the object to receive the result of the method callParseException
- if the code contained syntax errorsjava.lang.RuntimeException
- if there was an error running the codejava.lang.NoSuchMethodException
- if the method could not be foundpublic java.lang.String tagName()
public void addElement(java.lang.String tag_name)
public boolean containsElement(java.lang.String tag_name)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |