Ghidra Decompiler Analysis Engine
Public Member Functions | Protected Attributes | List of all members
Element Class Reference

An XML element. A node in the DOM tree. More...

#include <xml.hh>

Inheritance diagram for Element:
Inheritance graph
[legend]
Collaboration diagram for Element:
Collaboration graph
[legend]

Public Member Functions

 ~Element (void)
 Destructor.
 
void addContent (const char *str, int4 start, int4 length)
 Append new character content to this element. More...
 
void addChild (Element *child)
 Add a new child Element to the model, with this as the parent. More...
 
void addAttribute (const string &nm, const string &vl)
 Add a new name/value attribute pair to this element. More...
 
const string & getAttributeValue (const string &nm) const
 Get an attribute value by name. More...
 

Protected Attributes

Elementparent
 The parent Element (or null)
 
List children
 A list of child Element objects.
 

Detailed Description

An XML element. A node in the DOM tree.

This is the main node for the in-memory representation of the XML (DOM) tree.

Member Function Documentation

◆ addAttribute()

void Element::addAttribute ( const string &  nm,
const string &  vl 
)
inline

Add a new name/value attribute pair to this element.

Parameters
nmis the name of the attribute
vlis the value of the attribute

◆ addChild()

void Element::addChild ( Element child)
inline

Add a new child Element to the model, with this as the parent.

Parameters
childis the new child Element

◆ addContent()

void Element::addContent ( const char *  str,
int4  start,
int4  length 
)
inline

Append new character content to this element.

Parameters
stris an array of character data
startis the index of the first character to append
lengthis the number of characters to append

◆ getAttributeValue()

const string & Element::getAttributeValue ( const string &  nm) const

Get an attribute value by name.

Look up the value for the given attribute name and return it. An exception is thrown if the attribute does not exist.

Parameters
nmis the name of the attribute
Returns
the corresponding attribute value

The documentation for this class was generated from the following files: