Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress C++ API Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

rwsf::XmlWriter

Group:  Core XML


Does not inherit

Local Index

Members

Header File

#include rwsf/core/XmlWriter.h

Description

Class rwsf::XmlWriter is an abstract base class that provides an interface for writing XML messages. A derived class implements the protected methods to write output to a specific data sink, such as an std::string, a file, or a socket. Applications typically do not use classes derived from rwsf::XmlWriter directly. Instead, the application passes the writer to the marshal() method of a class generated by HydraAgent.

This class implements methods for creating and formatting XML elements. rwsf::XmlWriter also manages namespace declarations. The class uses the concept of a namespace scope for determining when to add a namespace declaration. A namespace scope extends from the point at which an element start tag is declared with writeElementStart() until an element end tag is declared with writeElementEnd(). Namespace scopes nest. When creating an element tag, the writer includes namespace declarations for namespaces that are not in scope.

Note that an rwsf::XmlWriter does not automatically produce a namespace declaration for the xsi:type attribute. An application must take care to declare the xsi namespace before producing an element with a schema type attribute. Classes generated by HydraAgent handle this transparently, so this is only a consideration if an application produces XML output outside of a marshal() method provided in a generate classes.

This class is intended to be flexible and suitable for use with streamed output. Therefore, the class does not strictly enforce well-formed XML. For example, there is no requirement that the name passed to writeElementEnd() match the name passed to the most recent call to writeElementStart().

Public Constructors

XmlWriter();

Public Destructors

virtual
~XmlWriter();

Public Member Functions

void
addNamespace(const rwsf::XmlNamespace & ns);
void
decrementIndent();
int
getCurrentIndent() const;
bool
getIgnoreWhitespace() const;
bool
getMustEscapeTextDefault() const;
int
getSizeOfIndent() const;
void
incrementIndent();
void
setCurrentIndent(int indent);
void
setIgnoreWhitespace(bool ignore);
void
setMustEscapeTextDefault(bool escape);
int
setSizeOfIndent(int indentSize_);
void
write(const char * textData,
    size_t textLength,
    bool mustEscapeText);
void
write(const std::string & text,
    bool mustEscapeText);
void
writeAttribute(const std::string & name,
    const std::string & value);
void
writeAttribute(const rwsf::XmlName & name,
    const std::string & value);
void
writeAttribute(const std::string & name,
    const std::string & value,
    bool mustEscapeText);
void
writeAttribute(const rwsf::XmlName & name,
    const std::string & value,
    bool mustEscapeText);
void
writeElementEnd(const rwsf::XmlName & name);
void
writeElementStart(const rwsf::XmlName & name,
    const rwsf::XmlAttributeSet & attributes = rwsf::XmlAttributeSet(),
    bool emptyElement = false);
void
writeIndentChars();
void
writeNewLine();
void
writeSimpleElement(const std::string & name,
    const std::string & value,
    const std::string & schemaType,
    bool includeTypeAttribute);
void
writeSimpleElement(const rwsf::XmlName & name,
    const std::string & value,
    const std::string & schemaType,
    bool includeTypeAttribute);

Protected Member Functions

void
flush() = 0;
void
writeToSink(const std::string & text);
void
writeToSink(const char *,
    size_t len) = 0;
void
writeToSink(char c) = 0;


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.