X3D libraries
The libraries to work with X3D dataset

x3dxml::XMLWriter Class Reference

An implementation of x3dio::Writer used to write a tree of nodes to a stream in XML format. More...

#include <xml.h>

Inheritance diagram for x3dxml::XMLWriter:

Inheritance graph
Collaboration diagram for x3dxml::XMLWriter:

Collaboration graph
List of all members.

Public Member Functions

virtual bool Save (x3dio::Stream *stream, const x3d::SFNode *node, x3dio::ErrorCallback *callback=0)
 Save node to stream in XML format.
 XMLWriter ()
 Initialize the XML writer.
virtual ~XMLWriter ()
 Destroy the XML writer.

Detailed Description

An implementation of x3dio::Writer used to write a tree of nodes to a stream in XML format.

The XML writer is a very optimized writer which takes an X3D tree and saves it in an XML file using the X3D format. It saves everything using the UTF-8 encoding.

You can instantiate the class on your stack or create an object with the new operator.

 ... // create the x3d_tree
 x3dio::FileStream stream;
 x3dxml::XMLWriter xml_out;
 // note: ignore errors
 xml_out.Save(stream, x3d_tree);

See also:

Constructor & Destructor Documentation

x3dxml::XMLWriter::XMLWriter  ) 

Initialize the XML writer.

The constructor will make sure that the writer is ready to be used.

x3dxml::XMLWriter::~XMLWriter  )  [virtual]

Destroy the XML writer.

The destructor deletes all the objects used internally.

Member Function Documentation

bool x3dxml::XMLWriter::Save x3dio::Stream stream,
const x3d::SFNode *  node,
x3dio::ErrorCallback callback = 0

Save node to stream in XML format.

This function will save the specified node to an XML file.

The stream will never be seeked.

See also:

Save the specified (root) node in the output stream.

This function is expected to be implemented by different libraries supporting different file formats (such as XML, VRML, OBJ, RAW, etc.)

The node is always expected to be a root node (i.e. an X3D node). If the node is not of the right type, the function should fail (thought some implementations may be capable of saving just a shape or some other X3D object).

The user can specify an error callback object. In this case, any error generated in the writer will be reported to the caller. Please, see the reference about the x3dio::ErrorCallback for more information on how messages are forwarded.

The writer can only write to the stream. Some writer's may need support for the x3dio::Stream::Seek() instruction. Please, see the reference of each writer for more information about that writer.

Implements x3dio::Writer.

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