Discussion
The transformation works identically for a character-based or element-based transformation. If your transformation is character-based, you have used the classes identified by the [character-based] tag in this discussion; if your transformation is element-based, you have used the classes identified by the [element-based] tag.
A number of things happen when you call the make() function of either
Here is the sequence for a transformation within an input stream:
[Character-based] | |
[Element-based] | |
This object encapsulates a transformation by
holding an
ifstream reference to
RWObjectInputStream.implementing a
transform() function that reads an XML stream from an
istream, applies the
make() function, and writes the transformed XML to an
ostream.
[Character-based] | |
[Element-based] | |
along with an input stream reference.
The template class
[Character-based] | |
[Element-based] | |
allows a transformation to be added to any kind of input stream since the input stream parameter is templatized.
The transformation object parameter is also templatized, which means you could pass it any transformation object. The
[Character-based] | |
[Element-based] | |
class supplied with the XML Streams Module implements its transform() method to use the included processor. However, you could create your own class for transformation objects that implements its transform() method to use some other process.
If you need to control the format of the data within the XML stream, the streams classes have a make() function that take a pointer reference to an std::ios object. The constructor for the XML stream fills this pointer with the address of a formatting object for the underlying character stream.
Here is an example for the class
[Character-based] | // uninitialized pointer std::ios* formatter; RWObjectOutputStream xostr = RWTTransformObjectOutputStreamImp::make( outfile,script,formatter); // manipulate data format formatter->precision(15); |
---|
[Element-based] | // uninitialized pointer std::ios* formatter; RWObjectOutputStream xostr = RWTParsedTransformObjectOutputStreamImp:: make(outfile,script,formatter); // manipulate data format formatter->precision(15); |
The following classes contain a make() function that supports a formatting object:
RWXmlObjectInputStreamImp RWXmlObjectOutputStreamImp RWTParsedTransformObjectInputStreamImp RWTParsedTransformObjectOutputStreamImp RWTTransformObjectInputStreamImp RWTTransformObjectOutputStreamImp