Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

QtXmlDocument Class Reference

#include <QtXmlDocument.h>

Inheritance diagram for QtXmlDocument:

Inheritance graph
[legend]
Collaboration diagram for QtXmlDocument:

Collaboration graph
[legend]
List of all members.

Detailed Description

An XML DOM Document handler using the Qt XML module.

Author:
Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 26 of file QtXmlDocument.h.

Public Types

enum  Status { Success, OpenError, ParseError, WriteError }
 Status codes for opening an XML document. More...

Public Member Functions

virtual void appendChild (XmlElement &)
 Appends the root element to the document.
virtual XmlElementcreateElement (const std::string &tagName)
 Creates a new DOM element wrapper object and returns a pointer to it.
virtual XmlTextNodecreateTextNode (const std::string &tag)
 Creates a new DOM Text node.
virtual XmlElementdocumentElement () const
 Returns the root document element.
 QtXmlDocument (const std::string &name)
 QtXmlDocument (QDomDocument document)
 The public constructor taking a Qt XML module QDocument as argument.
virtual Status saveToFile (const std::string &filename)
 Saves the document to the file.
virtual Status setContent (const std::string &filename)
 Sets the content of the XML document from the text in the file filename.

Private Member Functions

 QtXmlDocument (const QtXmlDocument &)
 A private copy constructor in order to avoid copying.

Private Attributes

QDomDocument m_document
 The DOM element wrapped by this object.


Member Enumeration Documentation

enum XmlDocument::Status [inherited]
 

Status codes for opening an XML document.

Enumerator:
Success 
OpenError 
ParseError 
WriteError 

Definition at line 33 of file XmlDocument.h.


Constructor & Destructor Documentation

QtXmlDocument::QtXmlDocument const QtXmlDocument  )  [private]
 

A private copy constructor in order to avoid copying.

QtXmlDocument::QtXmlDocument QDomDocument  document  ) 
 

The public constructor taking a Qt XML module QDocument as argument.

Definition at line 23 of file QtXmlDocument.cxx.

QtXmlDocument::QtXmlDocument const std::string name  ) 
 

Definition at line 29 of file QtXmlDocument.cxx.

References m_document.


Member Function Documentation

void QtXmlDocument::appendChild XmlElement  )  [virtual]
 

Appends the root element to the document.

Implements XmlDocument.

Definition at line 62 of file QtXmlDocument.cxx.

References m_document, and QtXmlNode::m_node.

XmlElement * QtXmlDocument::createElement const std::string tagName  )  [virtual]
 

Creates a new DOM element wrapper object and returns a pointer to it.

The receiver takes possesion of the object and is responsible for its deletion.

Implements XmlDocument.

Definition at line 45 of file QtXmlDocument.cxx.

References QDomDocument::createElement(), and m_document.

XmlTextNode * QtXmlDocument::createTextNode const std::string tag  )  [virtual]
 

Creates a new DOM Text node.

Implements XmlDocument.

Definition at line 54 of file QtXmlDocument.cxx.

References QDomDocument::createTextNode(), and m_document.

XmlElement * QtXmlDocument::documentElement  )  const [virtual]
 

Returns the root document element.

Implements XmlDocument.

Definition at line 35 of file QtXmlDocument.cxx.

References QDomDocument::documentElement(), and m_document.

XmlDocument::Status QtXmlDocument::saveToFile const std::string filename  )  [virtual]
 

Saves the document to the file.

Returns:
XmlDocument::Success if successful, otherwise XmlDocument::WriteError.

Implements XmlDocument.

Definition at line 72 of file QtXmlDocument.cxx.

References QFile::close(), m_document, QFile::open(), XmlDocument::Success, and XmlDocument::WriteError.

XmlDocument::Status QtXmlDocument::setContent const std::string filename  )  [virtual]
 

Sets the content of the XML document from the text in the file filename.

Also sets the application's current working directory to the path to the file. This is done so that files referenced by the XML document can be found relative to the document itself.

Returns:
XmlDocument::Success if successful. XmlDocument::OpenError if the file could not be opened or XmlDocument::ParseError if the file was not successfully parsed.

Implements XmlDocument.

Definition at line 90 of file QtXmlDocument.cxx.

References QFile::close(), QFileInfo::dirPath(), m_document, QFile::open(), XmlDocument::OpenError, XmlDocument::ParseError, QDomDocument::setContent(), QDir::setCurrent(), and XmlDocument::Success.


Member Data Documentation

QDomDocument QtXmlDocument::m_document [private]
 

The DOM element wrapped by this object.

Definition at line 32 of file QtXmlDocument.h.

Referenced by appendChild(), createElement(), createTextNode(), documentElement(), QtXmlDocument(), saveToFile(), and setContent().


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3