ITK  6.0.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
itk::DOMNodeXMLReader Class Reference

#include <itkDOMNodeXMLReader.h>

Detailed Description

Class to read a DOM object from an XML file or an input stream.

This class produces a DOM object, which can be subsequently used to create a corresponding user object.

We do not recommend to directly use this class for user object reading, because the user has to handle both DOM object generation from the input XML file and user object generation from the intermediate DOM object. Users should derive from the DOMReader, because it performs the former step automatically and lets the users concentrate on the latter step, thus implementation of such a reader is simplified.

Note: Though this class behaves similar to ProcessObject, it is not derived from ProcessObject. This is because the output of this class, i.e. a DOMNode object, is not a DataObject, thus this class cannot be connected to an ITK process pipeline.

The following code snippet demonstrates how to read a DOM object from an XML file:

itk::DOMNode::Pointer output_dom_object;
const char* input_xml_file_name = ...
itk::DOMNodeXMLReader::Pointer reader = itk::DOMNodeXMLReader::New();
reader->SetFileName( input_xml_file_name );
reader->Update();
output_dom_object = reader->GetOutput();
See also
DOMReader
DOMNode

Definition at line 61 of file itkDOMNodeXMLReader.h.

+ Inheritance diagram for itk::DOMNodeXMLReader:
+ Collaboration diagram for itk::DOMNodeXMLReader:

Public Types

using ConstPointer = SmartPointer< const Self >
 
using OutputPointer = OutputType::Pointer
 
using OutputType = DOMNode
 
using Pointer = SmartPointer< Self >
 
using Self = DOMNodeXMLReader
 
using Superclass = Object
 
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Object
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

virtual void CharacterDataHandler (const char *text, int len)
 
virtual void EndElement (const char *name)
 
virtual const char * GetFileName () const
 
const char * GetNameOfClass () const override
 
virtual void SetFileName (const char *_arg)
 
virtual void StartElement (const char *name, const char **atts)
 
virtual void Update ()
 
void Update (std::istream &is)
 
virtual void SetDOMNodeXML (OutputType *_arg)
 
virtual const OutputTypeGetOutput () const
 
virtual OutputTypeGetOutput ()
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *cmd) const
 
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
 
LightObject::Pointer CreateAnother () const override
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
virtual ModifiedTimeType GetMTime () const
 
const char * GetNameOfClass () const override
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag) const
 
void SetDebug (bool debugFlag) const
 
void SetReferenceCount (int) override
 
void UnRegister () const noexcept override
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
 
virtual Pointer CreateAnother () const
 
virtual void Delete ()
 
virtual const char * GetNameOfClass () const
 
virtual int GetReferenceCount () const
 
void Print (std::ostream &os, Indent indent=0) const
 
virtual void Register () const
 
virtual void SetReferenceCount (int)
 
virtual void UnRegister () const noexcept
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool val)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Protected Member Functions

 DOMNodeXMLReader ()
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
virtual void SetTimeStamp (const TimeStamp &timeStamp)
 
 ~Object () override
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintSelf (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 

Private Attributes

OutputTypem_Context { nullptr }
 
OutputPointer m_DOMNodeXML {}
 
std::string m_FileName {}
 

Additional Inherited Members

- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount {}
 

Member Typedef Documentation

◆ ConstPointer

Definition at line 71 of file itkDOMNodeXMLReader.h.

◆ OutputPointer

Definition at line 80 of file itkDOMNodeXMLReader.h.

◆ OutputType

Definition at line 79 of file itkDOMNodeXMLReader.h.

◆ Pointer

Definition at line 70 of file itkDOMNodeXMLReader.h.

◆ Self

Standard class type aliases.

Definition at line 68 of file itkDOMNodeXMLReader.h.

◆ Superclass

Definition at line 69 of file itkDOMNodeXMLReader.h.

Constructor & Destructor Documentation

◆ DOMNodeXMLReader()

itk::DOMNodeXMLReader::DOMNodeXMLReader ( )
protected

Member Function Documentation

◆ CharacterDataHandler()

virtual void itk::DOMNodeXMLReader::CharacterDataHandler ( const char *  text,
int  len 
)
virtual

Callback function – called from XML parser with the character data for an XML element.

◆ EndElement()

virtual void itk::DOMNodeXMLReader::EndElement ( const char *  name)
virtual

Callback function – called from XML parser when ending tag encountered.

◆ GetFileName()

virtual const char * itk::DOMNodeXMLReader::GetFileName ( ) const
virtual

Get the input XML filename.

◆ GetNameOfClass()

const char * itk::DOMNodeXMLReader::GetNameOfClass ( ) const
overridevirtual
See also
LightObject::GetNameOfClass()

Reimplemented from itk::Object.

◆ GetOutput() [1/2]

virtual OutputType * itk::DOMNodeXMLReader::GetOutput ( )
inlinevirtual

Provide an interface to match that of other ProcessObjects for this source generation object by returning a non-const pointer for the generated Object.

Definition at line 120 of file itkDOMNodeXMLReader.h.

◆ GetOutput() [2/2]

virtual const OutputType * itk::DOMNodeXMLReader::GetOutput ( ) const
inlinevirtual

Provide an interface to match that of other ProcessObjects for this source generation object by returning a non-const pointer for the generated Object.

Definition at line 115 of file itkDOMNodeXMLReader.h.

◆ New()

static Pointer itk::DOMNodeXMLReader::New ( )
static

Method for creation through the object factory.

Referenced by operator>>().

◆ SetDOMNodeXML()

virtual void itk::DOMNodeXMLReader::SetDOMNodeXML ( OutputType _arg)
virtual

Get/Set The output DOM object will be created automatically, but the user can appoint a user DOM object as the output by calling this function.

◆ SetFileName()

virtual void itk::DOMNodeXMLReader::SetFileName ( const char *  _arg)
virtual

Set the input XML filename.

◆ StartElement()

virtual void itk::DOMNodeXMLReader::StartElement ( const char *  name,
const char **  atts 
)
virtual

Callback function – called from XML parser with start-of-element information.

◆ Update() [1/2]

virtual void itk::DOMNodeXMLReader::Update ( )
virtual

Function called by end-users to generate the output DOM object from the input XML file.

◆ Update() [2/2]

void itk::DOMNodeXMLReader::Update ( std::istream &  is)

Function called by Update() or end-users to generate the output DOM object from an input stream such as file, string, etc.

Member Data Documentation

◆ m_Context

OutputType* itk::DOMNodeXMLReader::m_Context { nullptr }
private

Variable to keep the current context during XML parsing.

Definition at line 177 of file itkDOMNodeXMLReader.h.

◆ m_DOMNodeXML

OutputPointer itk::DOMNodeXMLReader::m_DOMNodeXML {}
private

Variable to hold the output DOM object, created internally or supplied by the user.

Definition at line 174 of file itkDOMNodeXMLReader.h.

◆ m_FileName

std::string itk::DOMNodeXMLReader::m_FileName {}
private

Variable to hold the input XML file name.

Definition at line 171 of file itkDOMNodeXMLReader.h.


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