class skXMLElementObject : public skExecutable

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

Inheritance:

skXMLElementObject < skExecutable


Public Methods

skXMLElementObject()
Default Constructor
skXMLElementObject(const skString& location, DOM_Element elem)
Constructor which takes an Element
~skXMLElementObject()
Destructor
int executableType() const
Returns XMLELEMENT_TYPE indicating the element is an XMLElementObject
int intValue() const
float floatValue() const
bool boolValue() const
char charValue() const
skString strValue() const
bool setValue(const skString& s, const skString& attribute, const skRValue& return_value)
sets the value of an item in the element
bool getValue(const skString& s, const skString& attribute, skRValue& return_value)
Retrieves a field from the XML
bool method(const skString& name, skRValueArray& args, skRValue& ret)
this method attempts to execute a method stored in the XML
bool equals(skExecutable * o) const
tests for equality with another object, using the string value
void copyItemsInto(DOM_Element other)
Clears the other element and does a deep copy of the children of this node into that one
DOM_Element getElement()
This method returns the XML Element being held by the object
static skString getData(DOM_Element element)
retrieves the text data from an element
static void setData(DOM_Element element, const skString& data)
sets the text data for a node by looking for the first CDATA and TEXT child node
static DOM_Element findChild(DOM_Element parent, const skString& tagname)
returns a child element
static DOM_Element findChild(DOM_Element parent, const skString& tagname, const skString& attribute, const skString& value)
returns a child element with the given attribute set to the given value
void setAttribute(skString name, const skString& value)
Sets an attribute on this node
skString getAttribute(const skString& name)
This method returns the value of an attribute attached to this element
static skString toString(DOMString str)
Converts a Xerces DOMString to a Simkin skString
static DOMString fromString(const skString& str)
Converts a Simkin skString to a Xerces DOMString

Protected Fields

skString m_ScriptLocation
the location that the XML document came from

Protected Methods

void setElement(DOM_Element element)
This method updates the associated element and clears the parse tree cache

Inherited from skExecutable:


Documentation

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 methods getValue, setValue and method all search for matching element tags within the XML document. Only the first matching tag is used. The class uses the Xerces library to access XML documents
skXMLElementObject()
Default Constructor

skXMLElementObject(const skString& location, DOM_Element elem)
Constructor which takes an Element
Parameters:
location - - used to identify the source of the document in error messages
elem - - the element to be stored

~skXMLElementObject()
Destructor

int executableType() const
Returns XMLELEMENT_TYPE indicating the element is an XMLElementObject
Returns:
the type as XML element

int intValue() const
Returns:
the value of the element text data as an integer

float floatValue() const
Returns:
the value of the element text data as a float

bool boolValue() const
Returns:
the value of the element text data as a boolean

char charValue() const
Returns:
the first character of the element text data

skString strValue() const
Returns:
the value of the element text data as a string

bool setValue(const skString& s, const skString& attribute, const skRValue& return_value)
sets the value of an item in the element. The first sub-element matching the tag is found. If the value passed is an element, it is first copied.
Returns:
true if the field was found, false otherwise
Parameters:
name - - the name of the element tag to set (null if it's the overall element)
attribute - - the name of the attribute to set (null to set text for the element)
return_value - - the RValue to receive the value

bool getValue(const skString& s, const skString& attribute, skRValue& return_value)
Retrieves a field from the XML. The first sub-element matching the tag is found. The value returned is an XMLElementObject, unless the attrib value is specified
Returns:
true if the method was found, false otherwise
Parameters:
name - - the tag name containing the data
attrib - - the attribute name to retrieve
return_value - - the RValue to containing the value to be set

bool method(const skString& name, skRValueArray& args, skRValue& ret)
this method attempts to execute a method stored in the XML. It searches for an element whose tag matches the method name and if found passes the text for the tag through to the interpeter
Returns:
true if the method was found, false otherwise
Parameters:
name - the name of the method
args - an array of arguments to the method
ret - the object to receive the result of the method call

bool equals(skExecutable * o) const
tests for equality with another object, using the string value
Returns:
true if the data in both elements is the same

void copyItemsInto(DOM_Element other)
Clears the other element and does a deep copy of the children of this node into that one
Parameters:
child - - the element into which our children will be copied

DOM_Element getElement()
This method returns the XML Element being held by the object
Returns:
the underlying Element

static skString getData(DOM_Element element)
retrieves the text data from an element
Returns:
the text from a child node of type CDATA or TEXT
Parameters:
element -

static void setData(DOM_Element element, const skString& data)
sets the text data for a node by looking for the first CDATA and TEXT child node
Parameters:
element - the element to be changed
data - the data to be set

static DOM_Element findChild(DOM_Element parent, const skString& tagname)
returns a child element
Returns:
the first element child of the parent with the matching tag name, or null if not found
Parameters:
parent - the parent element
tagname - the tag name of the element

static DOM_Element findChild(DOM_Element parent, const skString& tagname, const skString& attribute, const skString& value)
returns a child element with the given attribute set to the given value
Returns:
the first element child of the parent with the matching tag name and attribute value, or null if not found
Parameters:
parent - the parent element
tagname - the tag name of the element
attribute - name of the attribute
value - value of the named attribute

void setAttribute(skString name, const skString& value)
Sets an attribute on this node

skString getAttribute(const skString& name)
This method returns the value of an attribute attached to this element
Returns:
the value of the given attribute

static skString toString(DOMString str)
Converts a Xerces DOMString to a Simkin skString

static DOMString fromString(const skString& str)
Converts a Simkin skString to a Xerces DOMString

void setElement(DOM_Element element)
This method updates the associated element and clears the parse tree cache
Parameters:
elem - - the new Element

skString m_ScriptLocation
the location that the XML document came from


Direct child classes:
skXMLExecutable

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de