ParaView
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
vtkPVXMLElement Class Reference

This is used by vtkPVXMLParser to represent an XML document starting at the root element. More...

#include <vtkPVXMLElement.h>

Inherits vtkObject.

Collaboration diagram for vtkPVXMLElement:
Collaboration graph
[legend]

Public Types

typedef vtkObject Superclass
 

Public Member Functions

virtual const char * GetClassName ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent)
 
const char * GetAttribute (const char *name)
 Get the attribute with the given name. More...
 
const char * GetAttributeOrEmpty (const char *name)
 Get the attribute with the given name. More...
 
const char * GetAttributeOrDefault (const char *name, const char *notFound)
 Get the attribute with the given name. More...
 
const char * GetCharacterData ()
 Get the character data for the element. More...
 
vtkPVXMLElementGetParent ()
 Get the parent of this element. More...
 
unsigned int GetNumberOfNestedElements ()
 Get the number of elements nested in this one. More...
 
vtkPVXMLElementGetNestedElement (unsigned int index)
 Get the element nested in this one at the given index. More...
 
vtkPVXMLElementFindNestedElement (const char *id)
 Find a nested element with the given id. More...
 
vtkPVXMLElementFindNestedElementByName (const char *name)
 Locate a nested element with the given tag name. More...
 
void FindNestedElementByName (const char *name, vtkCollection *elements)
 Locate a set of nested elements with the given tag name. More...
 
void RemoveAllNestedElements ()
 Removes all nested elements. More...
 
void RemoveNestedElement (vtkPVXMLElement *)
 Remove a particular element. More...
 
vtkPVXMLElementLookupElement (const char *id)
 Lookup the element with the given id, starting at this scope. More...
 
void RemoveAttribute (const char *attrName)
 Remove the attribute from the current element. More...
 
void SetAttribute (const char *attrName, const char *attrValue)
 Given it's name and value, set an attribute. More...
 
void Merge (vtkPVXMLElement *element, const char *attributeName)
 Merges another element with this one, both having the same name. More...
 
bool Equals (vtkPVXMLElement *other)
 Return true if the current object has the same content as the other. More...
 
void CopyTo (vtkPVXMLElement *other)
 Copy the current XML element content into the provided one. More...
 
void CopyAttributesTo (vtkPVXMLElement *other)
 Copy the attributes from current XML element content into the provided one. More...
 
virtual void SetName (const char *)
 Set/Get the name of the element. More...
 
virtual char * GetName ()
 Set/Get the name of the element. More...
 
virtual char * GetId ()
 Get the id of the element. More...
 
int GetScalarAttribute (const char *name, int *value)
 Get the attribute with the given name converted to a scalar value. More...
 
int GetScalarAttribute (const char *name, float *value)
 Get the attribute with the given name converted to a scalar value. More...
 
int GetScalarAttribute (const char *name, double *value)
 Get the attribute with the given name converted to a scalar value. More...
 
int GetVectorAttribute (const char *name, int length, int *value)
 Get the attribute with the given name converted to a scalar value. More...
 
int GetVectorAttribute (const char *name, int length, float *value)
 Get the attribute with the given name converted to a scalar value. More...
 
int GetVectorAttribute (const char *name, int length, double *value)
 Get the attribute with the given name converted to a scalar value. More...
 
int GetCharacterDataAsVector (int length, int *value)
 Get the character data converted to a scalar value. More...
 
int GetCharacterDataAsVector (int length, float *value)
 Get the character data converted to a scalar value. More...
 
int GetCharacterDataAsVector (int length, double *value)
 Get the character data converted to a scalar value. More...
 
void AddAttribute (const char *attrName, const char *attrValue)
 Given it's name and value, add an attribute. More...
 
void AddAttribute (const char *attrName, unsigned int attrValue)
 Given it's name and value, add an attribute. More...
 
void AddAttribute (const char *attrName, double attrValue)
 Given it's name and value, add an attribute. More...
 
void AddAttribute (const char *attrName, double attrValue, int precision)
 Given it's name and value, add an attribute. More...
 
void AddAttribute (const char *attrName, int attrValue)
 Given it's name and value, add an attribute. More...
 
void AddNestedElement (vtkPVXMLElement *element, int setPrent)
 Add a sub-element. More...
 
void AddNestedElement (vtkPVXMLElement *element)
 Add a sub-element. More...
 
void PrintXML (ostream &os, vtkIndent indent)
 Serialize (as XML) in the given stream. More...
 
void PrintXML ()
 Serialize (as XML) in the given stream. More...
 
void GetElementsByName (const char *name, vtkCollection *elements)
 Similar to DOM sepecific getElementsByTagName(). More...
 
void GetElementsByName (const char *name, vtkCollection *elements, bool recursively)
 Similar to DOM sepecific getElementsByTagName(). More...
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkPVXMLElementSafeDownCast (vtkObject *o)
 
static vtkPVXMLElementNew ()
 
static vtkStdString Encode (const char *plaintext)
 Encode a string. More...
 

Protected Member Functions

 vtkPVXMLElement ()
 
 ~vtkPVXMLElement ()
 
virtual void SetId (const char *)
 
void ReadXMLAttributes (const char **atts)
 
void AddCharacterData (const char *data, int length)
 
vtkPVXMLElementLookupElementInScope (const char *id)
 
vtkPVXMLElementLookupElementUpScope (const char *id)
 
void SetParent (vtkPVXMLElement *parent)
 

Protected Attributes

vtkPVXMLElementInternals * Internal
 
char * Name
 
char * Id
 
vtkPVXMLElementParent
 

Friends

class vtkPVXMLParser
 

Detailed Description

This is used by vtkPVXMLParser to represent an XML document starting at the root element.

Definition at line 34 of file vtkPVXMLElement.h.

Member Typedef Documentation

§ Superclass

typedef vtkObject vtkPVXMLElement::Superclass

Definition at line 37 of file vtkPVXMLElement.h.

Constructor & Destructor Documentation

§ vtkPVXMLElement()

vtkPVXMLElement::vtkPVXMLElement ( )
protected

§ ~vtkPVXMLElement()

vtkPVXMLElement::~vtkPVXMLElement ( )
protected

Member Function Documentation

§ GetClassName()

virtual const char* vtkPVXMLElement::GetClassName ( )
virtual

§ IsTypeOf()

static int vtkPVXMLElement::IsTypeOf ( const char *  type)
static

§ IsA()

virtual int vtkPVXMLElement::IsA ( const char *  type)
virtual

§ SafeDownCast()

static vtkPVXMLElement* vtkPVXMLElement::SafeDownCast ( vtkObject *  o)
static

§ PrintSelf()

void vtkPVXMLElement::PrintSelf ( ostream &  os,
vtkIndent  indent 
)

§ New()

static vtkPVXMLElement* vtkPVXMLElement::New ( )
static

§ SetName()

virtual void vtkPVXMLElement::SetName ( const char *  )
virtual

Set/Get the name of the element.

This is its XML tag. (<Name>).

§ GetName()

virtual char* vtkPVXMLElement::GetName ( )
virtual

Set/Get the name of the element.

This is its XML tag. (<Name>).

§ GetId()

virtual char* vtkPVXMLElement::GetId ( )
virtual

Get the id of the element.

This is assigned by the XML parser and can be used as an identifier to an element.

§ GetAttribute()

const char* vtkPVXMLElement::GetAttribute ( const char *  name)
inline

Get the attribute with the given name.

If it doesn't exist, returns NULL.

Definition at line 62 of file vtkPVXMLElement.h.

§ GetAttributeOrEmpty()

const char* vtkPVXMLElement::GetAttributeOrEmpty ( const char *  name)
inline

Get the attribute with the given name.

If it doesn't exist, returns "".

Definition at line 68 of file vtkPVXMLElement.h.

§ GetAttributeOrDefault()

const char* vtkPVXMLElement::GetAttributeOrDefault ( const char *  name,
const char *  notFound 
)

Get the attribute with the given name.

If it doesn't exist, returns the provided notFound value.

§ GetCharacterData()

const char* vtkPVXMLElement::GetCharacterData ( )

Get the character data for the element.

§ GetScalarAttribute() [1/3]

int vtkPVXMLElement::GetScalarAttribute ( const char *  name,
int *  value 
)

Get the attribute with the given name converted to a scalar value.

Returns whether value was extracted.

§ GetScalarAttribute() [2/3]

int vtkPVXMLElement::GetScalarAttribute ( const char *  name,
float *  value 
)

Get the attribute with the given name converted to a scalar value.

Returns whether value was extracted.

§ GetScalarAttribute() [3/3]

int vtkPVXMLElement::GetScalarAttribute ( const char *  name,
double *  value 
)

Get the attribute with the given name converted to a scalar value.

Returns whether value was extracted.

§ GetVectorAttribute() [1/3]

int vtkPVXMLElement::GetVectorAttribute ( const char *  name,
int  length,
int *  value 
)

Get the attribute with the given name converted to a scalar value.

Returns length of vector read.

§ GetVectorAttribute() [2/3]

int vtkPVXMLElement::GetVectorAttribute ( const char *  name,
int  length,
float *  value 
)

Get the attribute with the given name converted to a scalar value.

Returns length of vector read.

§ GetVectorAttribute() [3/3]

int vtkPVXMLElement::GetVectorAttribute ( const char *  name,
int  length,
double *  value 
)

Get the attribute with the given name converted to a scalar value.

Returns length of vector read.

§ GetCharacterDataAsVector() [1/3]

int vtkPVXMLElement::GetCharacterDataAsVector ( int  length,
int *  value 
)

Get the character data converted to a scalar value.

Returns length of vector read.

§ GetCharacterDataAsVector() [2/3]

int vtkPVXMLElement::GetCharacterDataAsVector ( int  length,
float *  value 
)

Get the character data converted to a scalar value.

Returns length of vector read.

§ GetCharacterDataAsVector() [3/3]

int vtkPVXMLElement::GetCharacterDataAsVector ( int  length,
double *  value 
)

Get the character data converted to a scalar value.

Returns length of vector read.

§ GetParent()

vtkPVXMLElement* vtkPVXMLElement::GetParent ( )

Get the parent of this element.

§ GetNumberOfNestedElements()

unsigned int vtkPVXMLElement::GetNumberOfNestedElements ( )

Get the number of elements nested in this one.

§ GetNestedElement()

vtkPVXMLElement* vtkPVXMLElement::GetNestedElement ( unsigned int  index)

Get the element nested in this one at the given index.

§ FindNestedElement()

vtkPVXMLElement* vtkPVXMLElement::FindNestedElement ( const char *  id)

Find a nested element with the given id.

Not that this searches only the immediate children of this vtkPVXMLElement.

§ FindNestedElementByName() [1/2]

vtkPVXMLElement* vtkPVXMLElement::FindNestedElementByName ( const char *  name)

Locate a nested element with the given tag name.

§ FindNestedElementByName() [2/2]

void vtkPVXMLElement::FindNestedElementByName ( const char *  name,
vtkCollection *  elements 
)

Locate a set of nested elements with the given tag name.

§ RemoveAllNestedElements()

void vtkPVXMLElement::RemoveAllNestedElements ( )

Removes all nested elements.

§ RemoveNestedElement()

void vtkPVXMLElement::RemoveNestedElement ( vtkPVXMLElement )

Remove a particular element.

§ LookupElement()

vtkPVXMLElement* vtkPVXMLElement::LookupElement ( const char *  id)

Lookup the element with the given id, starting at this scope.

§ AddAttribute() [1/5]

void vtkPVXMLElement::AddAttribute ( const char *  attrName,
const char *  attrValue 
)

Given it's name and value, add an attribute.

§ AddAttribute() [2/5]

void vtkPVXMLElement::AddAttribute ( const char *  attrName,
unsigned int  attrValue 
)

Given it's name and value, add an attribute.

§ AddAttribute() [3/5]

void vtkPVXMLElement::AddAttribute ( const char *  attrName,
double  attrValue 
)

Given it's name and value, add an attribute.

§ AddAttribute() [4/5]

void vtkPVXMLElement::AddAttribute ( const char *  attrName,
double  attrValue,
int  precision 
)

Given it's name and value, add an attribute.

§ AddAttribute() [5/5]

void vtkPVXMLElement::AddAttribute ( const char *  attrName,
int  attrValue 
)

Given it's name and value, add an attribute.

§ RemoveAttribute()

void vtkPVXMLElement::RemoveAttribute ( const char *  attrName)

Remove the attribute from the current element.

§ SetAttribute()

void vtkPVXMLElement::SetAttribute ( const char *  attrName,
const char *  attrValue 
)

Given it's name and value, set an attribute.

If an attribute with the given name already exists, it replaces the old attribute. chars that need to be XML escaped will be done so internally for example " will be converted to "

§ AddNestedElement() [1/2]

void vtkPVXMLElement::AddNestedElement ( vtkPVXMLElement element,
int  setPrent 
)

Add a sub-element.

The parent element keeps a reference to sub-element. If setParent is true, the nested element's parent is set as this.

§ AddNestedElement() [2/2]

void vtkPVXMLElement::AddNestedElement ( vtkPVXMLElement element)

Add a sub-element.

The parent element keeps a reference to sub-element. If setParent is true, the nested element's parent is set as this.

§ PrintXML() [1/2]

void vtkPVXMLElement::PrintXML ( ostream &  os,
vtkIndent  indent 
)

Serialize (as XML) in the given stream.

§ PrintXML() [2/2]

void vtkPVXMLElement::PrintXML ( )

Serialize (as XML) in the given stream.

§ Merge()

void vtkPVXMLElement::Merge ( vtkPVXMLElement element,
const char *  attributeName 
)

Merges another element with this one, both having the same name.

If any attribute, character data or nested element exists in both, the passed in one will override this one's. If they don't exist, they'll be added. If nested elements have the same names, the optional attributeName maybe passed in as another criteria to determine what to merge in case of same names.

§ GetElementsByName() [1/2]

void vtkPVXMLElement::GetElementsByName ( const char *  name,
vtkCollection *  elements 
)

Similar to DOM sepecific getElementsByTagName().

Returns a list of vtkPVXMLElements with the given name in the order in which they will be encountered in a preorder traversal of the sub-tree under this node. The elements are populated in the vtkCollection passed as an argument.

§ GetElementsByName() [2/2]

void vtkPVXMLElement::GetElementsByName ( const char *  name,
vtkCollection *  elements,
bool  recursively 
)

Similar to DOM sepecific getElementsByTagName().

Returns a list of vtkPVXMLElements with the given name in the order in which they will be encountered in a preorder traversal of the sub-tree under this node. The elements are populated in the vtkCollection passed as an argument.

§ Encode()

static vtkStdString vtkPVXMLElement::Encode ( const char *  plaintext)
static

Encode a string.

§ Equals()

bool vtkPVXMLElement::Equals ( vtkPVXMLElement other)

Return true if the current object has the same content as the other.

The comparison implementation is pretty weak in the mean that we compare resulting XML string.

§ CopyTo()

void vtkPVXMLElement::CopyTo ( vtkPVXMLElement other)

Copy the current XML element content into the provided one.

§ CopyAttributesTo()

void vtkPVXMLElement::CopyAttributesTo ( vtkPVXMLElement other)

Copy the attributes from current XML element content into the provided one.

§ SetId()

virtual void vtkPVXMLElement::SetId ( const char *  )
protectedvirtual

§ ReadXMLAttributes()

void vtkPVXMLElement::ReadXMLAttributes ( const char **  atts)
protected

§ AddCharacterData()

void vtkPVXMLElement::AddCharacterData ( const char *  data,
int  length 
)
protected

§ LookupElementInScope()

vtkPVXMLElement* vtkPVXMLElement::LookupElementInScope ( const char *  id)
protected

§ LookupElementUpScope()

vtkPVXMLElement* vtkPVXMLElement::LookupElementUpScope ( const char *  id)
protected

§ SetParent()

void vtkPVXMLElement::SetParent ( vtkPVXMLElement parent)
protected

Friends And Related Function Documentation

§ vtkPVXMLParser

friend class vtkPVXMLParser
friend

Definition at line 282 of file vtkPVXMLElement.h.

Member Data Documentation

§ Internal

vtkPVXMLElementInternals* vtkPVXMLElement::Internal
protected

Definition at line 264 of file vtkPVXMLElement.h.

§ Name

char* vtkPVXMLElement::Name
protected

Definition at line 266 of file vtkPVXMLElement.h.

§ Id

char* vtkPVXMLElement::Id
protected

Definition at line 267 of file vtkPVXMLElement.h.

§ Parent

vtkPVXMLElement* vtkPVXMLElement::Parent
protected

Definition at line 270 of file vtkPVXMLElement.h.


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