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>

Inheritance diagram for vtkPVXMLElement:
Inheritance graph
[legend]
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) override
 
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...
 
void ReplaceNestedElement (vtkPVXMLElement *elementToReplace, vtkPVXMLElement *element)
 Replace a particular element with another. 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 specific getElementsByTagName(). More...
 
void GetElementsByName (const char *name, vtkCollection *elements, bool recursively)
 Similar to DOM specific getElementsByTagName(). More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
bool GetDebug ()
 
void SetDebug (bool debugFlag)
 
virtual void Modified ()
 
virtual vtkMTimeType GetMTime ()
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
int HasObserver (unsigned long event)
 
int HasObserver (const char *event)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 
virtual void Delete ()
 
virtual void FastDelete ()
 
void Print (ostream &os)
 
virtual void Register (vtkObjectBase *o)
 
virtual void UnRegister (vtkObjectBase *o)
 
void SetReferenceCount (int)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 
void PrintRevisions (ostream &)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 
void PrintRevisions (ostream &)
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkPVXMLElementSafeDownCast (vtkObject *o)
 
static vtkPVXMLElementNew ()
 
static std::string Encode (const char *plaintext)
 Encode a string. More...
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 
static void BreakOnError ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 
static vtkObjectBaseNew ()
 
static vtkObjectBaseNew ()
 

Protected Member Functions

 vtkPVXMLElement ()
 
 ~vtkPVXMLElement () override
 
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 Member Functions inherited from vtkObject
 vtkObject ()
 
virtual ~vtkObject ()
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

vtkPVXMLElementInternals * Internal
 
char * Name
 
char * Id
 
vtkPVXMLElementParent
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
vtkAtomicInt32 ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Friends

class vtkPVXMLParser
 

Detailed Description

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

Definition at line 23 of file vtkPVXMLElement.h.

Member Typedef Documentation

◆ Superclass

Definition at line 26 of file vtkPVXMLElement.h.

Constructor & Destructor Documentation

◆ vtkPVXMLElement()

vtkPVXMLElement::vtkPVXMLElement ( )
protected

◆ ~vtkPVXMLElement()

vtkPVXMLElement::~vtkPVXMLElement ( )
overrideprotected

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

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

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

◆ PrintSelf()

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

Reimplemented from vtkObject.

◆ 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 nullptr.

Definition at line 51 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 57 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 1 if a 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 1 if a 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 1 if a 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.

◆ ReplaceNestedElement()

void vtkPVXMLElement::ReplaceNestedElement ( vtkPVXMLElement elementToReplace,
vtkPVXMLElement element 
)

Replace a particular element with another.

◆ 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 specific 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 specific 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 std::string 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 276 of file vtkPVXMLElement.h.

Member Data Documentation

◆ Internal

vtkPVXMLElementInternals* vtkPVXMLElement::Internal
protected

Definition at line 258 of file vtkPVXMLElement.h.

◆ Name

char* vtkPVXMLElement::Name
protected

Definition at line 260 of file vtkPVXMLElement.h.

◆ Id

char* vtkPVXMLElement::Id
protected

Definition at line 261 of file vtkPVXMLElement.h.

◆ Parent

vtkPVXMLElement* vtkPVXMLElement::Parent
protected

Definition at line 264 of file vtkPVXMLElement.h.


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