Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
XML Streams Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

5.3 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

[Character-based]

RWTTransformObjectInputStreamImp or RWTTransformObjectOutputStreamImp.

[Element-based]

RWTParsedTransformObjectInputStreamImp or RWTParsedTransformObjectOutputStreamImp.

Here is the sequence for a transformation within an input stream:

  1. The RWObjectInputStream is used to construct a

    [Character-based] RWTTransformObjectInputStreamImp object.

    [Element-based] RWTParsedTransformObjectInputStreamImp object.

    This object encapsulates a transformation by

  2. The RWObjectInputStream is passed to

    [Character-based]

    RWTTransformInputStreamImp::make()

    [Element-based]

    RWTParsedTransformInputStreamImp::make()

    along with an input stream reference.

    The template class

    [Character-based]

    RWTTransformInputStreamImp

    [Element-based]

    RWTParsedTransformInputStreamImp

    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]

RWTTransformObjectInputStreamImp

[Element-based]

RWTParsedTransformObjectInputStreamImp

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]

RWTTransformObjectOutputStreamImp

// uninitialized pointer
std::ios* formatter;
RWObjectOutputStream xostr = 
   RWTTransformObjectOutputStreamImp::make(
       outfile,script,formatter);
// manipulate data format
formatter->precision(15);

[Element-based]

RWTParsedTransformObjectOutputStreamImp

// 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:



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.