Modeler Extensions Framework
|
Public Member Functions | |
XMLElement (CLEMEXTXML *item=NULL) | |
virtual | ~XMLElement () |
void | getName (std::string &name) |
bool | hasAttribute (const std::string &name) |
void | getAttribute (const std::string &name, std::string &value) |
std::string | getAttribute (const std::string &name) |
XMLElement | getElementByAttribute (const std::string name, const std::string &attr_name, const std::string attr_value) |
bool | getAttribute (const std::string &name, CLEMEXTReal &value) |
bool | getAttribute (const std::string &name, CLEMEXTInteger &value) |
void | addAttribute (const std::string &name, const std::string &value) |
void | addAttribute (const std::string &name, CLEMEXTInteger value) |
void | removeAttribute (const std::string &name) |
XMLElementIterator | getElements (const std::string &name) |
XMLTextIterator | getTextSections () |
XMLElement | addElement (const std::string &name) |
void | addText (const std::string &data) |
bool | isValid () const |
XMLElement | getElement (const std::string &name) |
XMLElement | getElement (const std::string &name, int index) |
Protected Attributes | |
CLEMEXTXML * | item_ |
a class wrapping an XML element, allowing attributes and elements to be queried and extended
Definition at line 129 of file XMLHelper.h.
XMLElement | ( | CLEMEXTXML * | item = NULL | ) |
create from a CLEMEXT C-API object
item | the CLEMEXT C-API object pointer representing an XML element |
|
virtual |
destroy, but do not delete the underlying CLEMEXTXML object
void addAttribute | ( | const std::string & | name, |
const std::string & | value | ||
) |
add an attribute
name | the name of the attribute |
value | the value of the attribute |
void addAttribute | ( | const std::string & | name, |
CLEMEXTInteger | value | ||
) |
add an attribute
name | the name of the attribute |
value | the value of the attribute |
XMLElement addElement | ( | const std::string & | name | ) |
add a new child element to this element
name | the name of the element |
void addText | ( | const std::string & | data | ) |
add new text to the element
data | text string to add |
void getAttribute | ( | const std::string & | name, |
std::string & | value | ||
) |
return the value of an attribute
name | the name of the attribute |
value | reference to a string in which to return the attribute value (or empty string if the attribute does not exist) |
std::string getAttribute | ( | const std::string & | name | ) |
convenience method - same as getAttribute(string, string) but return attribute value directly as a string.
bool getAttribute | ( | const std::string & | name, |
CLEMEXTReal & | value | ||
) |
return the value of an attribute as a double precision number
name | the name of the attribute |
value | reference to a CEFReal in which to return the attribute value (or 0.0 if the attribute does not exist) |
bool getAttribute | ( | const std::string & | name, |
CLEMEXTInteger & | value | ||
) |
return the value of an attribute as a 64-bit signed integer
name | the name of the attribute |
value | reference to a CEFInteger in which to return the attribute value (or 0.0 if the attribute does not exist) |
XMLElement getElement | ( | const std::string & | name | ) |
gets the sub-element with the specified name. Will only retrieve immediate children. If there is more than one node with this name, retrieves only the first one. If the element doesn't exist, throws an XMLException (with message).
XMLElement getElement | ( | const std::string & | name, |
int | index | ||
) |
gets the sub-element with the specified name and index. Will only retrieve immediate children. If the element doesn't exist, throws an XMLException (with message).
XMLElement getElementByAttribute | ( | const std::string | name, |
const std::string & | attr_name, | ||
const std::string | attr_value | ||
) |
Get the child element with the specified name possessing an attribute with the specified attribute name and value.
XMLElementIterator getElements | ( | const std::string & | name | ) |
open an iterator over a subset of the element's child elements
name | the name of the child elements to iterate over |
void getName | ( | std::string & | name | ) |
return the name of this element
name | return name of the element in referenced string |
XMLTextIterator getTextSections | ( | ) |
open an iterator over a subset of the element's character data sections
bool hasAttribute | ( | const std::string & | name | ) |
does the element have an attribute?
name | the name of the attribute to test |
bool isValid | ( | ) | const |
does this document contain valid XML
void removeAttribute | ( | const std::string & | name | ) |
remove an attribute (if it exists)
name | the name of the attribute |
|
protected |
Definition at line 131 of file XMLHelper.h.