XBinder XML Runtime  XBinder Version 3.0.x
Public Member Functions | Protected Member Functions | List of all members
OSXMLEncodeBase Class Reference

OSXMLEncodeBase is a base class for the XML encode buffer and stream classes, OSXMLEncodeBuffer and OSXMLEncodeStream. More...

#include <OSXMLMessageBuffer.h>

Inheritance diagram for OSXMLEncodeBase:
OSXMLMessageBuffer OSXMLEncodeBuffer OSXMLEncodeStream

Public Member Functions

EXTXMLMETHOD int encodeAttr (const OSUTF8CHAR *name, const OSUTF8CHAR *value)
 This function encodes an attribute in which the name and value are given as null-terminated UTF-8 strings. More...
 
EXTXMLMETHOD int encodeText (const OSUTF8CHAR *value)
 This method encodes XML textual content. More...
 
EXTXMLMETHOD int endDocument ()
 This method ends an XML document by flushing any remaining data to the stream.
 
EXTXMLMETHOD int endElement (const OSUTF8CHAR *elemName, OSXMLNamespace *pNS=0)
 This method encodes an end element tag value (</elemName>). More...
 
EXTXMLMETHOD int startDocument ()
 This method writes information to start an XML document to the encode stream. More...
 
EXTXMLMETHOD int startElement (const OSUTF8CHAR *elemName, OSXMLNamespace *pNS=0, OSRTDList *pNSAttrs=0, OSBOOL terminate=FALSE)
 This method writes information to start an XML element to the encode stream. More...
 
EXTXMLMETHOD int termStartElement ()
 This metod terminates a currently open XML start element by adding either a '>' or '/>' (if empty) terminator. More...
 
- Public Member Functions inherited from OSXMLMessageBuffer
virtual EXTXMLMETHOD void * getAppInfo ()
 The getAppInfo method returns the pointer to application context information.
 
EXTXMLMETHOD int getIndent ()
 This method returns current XML output indent value. More...
 
EXTXMLMETHOD int getIndentChar ()
 This method returns current XML output indent character value (default is space). More...
 
EXTXMLMETHOD OSBOOL getWriteBOM ()
 This function returns whether writing the Unicode BOM is currently enabled or disabled. More...
 
virtual EXTXMLMETHOD void setNamespace (const OSUTF8CHAR *prefix, const OSUTF8CHAR *uri, OSRTDList *pNSAttrs=0)
 This method sets a namespace in the context namespace list. More...
 
virtual EXTXMLMETHOD void setAppInfo (void *pXMLInfo)
 This method sets application specific context information within the common context structure. More...
 
EXTXMLMETHOD void setFormatting (OSBOOL doFormatting)
 This method sets XML output formatting to the given value. More...
 
EXTXMLMETHOD void setIndent (OSUINT8 indent)
 This method sets XML output indent to the given value. More...
 
EXTXMLMETHOD void setIndentChar (char indentChar)
 This method sets XML output indent character to the given value. More...
 
EXTXMLMETHOD void setWriteBOM (OSBOOL write)
 This method sets whether to write the Unicode byte order mark before the XML header. More...
 

Protected Member Functions

EXTXMLMETHOD OSXMLEncodeBase (OSRTContext *pContext=0)
 The protected constructor creates a new context and sets the buffer class type. More...
 
- Protected Member Functions inherited from OSXMLMessageBuffer
EXTXMLMETHOD OSXMLMessageBuffer (Type bufferType, OSRTContext *pContext=0)
 The protected constructor creates a new context and sets the buffer class type. More...
 

Detailed Description

OSXMLEncodeBase is a base class for the XML encode buffer and stream classes, OSXMLEncodeBuffer and OSXMLEncodeStream.

Definition at line 153 of file OSXMLMessageBuffer.h.

Constructor & Destructor Documentation

◆ OSXMLEncodeBase()

EXTXMLMETHOD OSXMLEncodeBase::OSXMLEncodeBase ( OSRTContext *  pContext = 0)
protected

The protected constructor creates a new context and sets the buffer class type.

Parameters
pContextPointer to a context to use. If NULL, new context will be allocated.

Member Function Documentation

◆ encodeAttr()

EXTXMLMETHOD int OSXMLEncodeBase::encodeAttr ( const OSUTF8CHAR *  name,
const OSUTF8CHAR *  value 
)

This function encodes an attribute in which the name and value are given as null-terminated UTF-8 strings.

Parameters
nameAttribute name.
valueUTF-8 string value to be encoded.
Returns
Completion status of operation:
  • 0 = success,
  • negative return value is error.

◆ encodeText()

EXTXMLMETHOD int OSXMLEncodeBase::encodeText ( const OSUTF8CHAR *  value)

This method encodes XML textual content.

XML metadata characters such as '<' are escaped. The input value is specified in UTF-8 character format but may be transformed if a different character encoding is enabled.

Parameters
valueUTF-8 string value to be encoded.
Returns
Completion status of operation:
  • 0 = success,
  • negative return value is error.

◆ endElement()

EXTXMLMETHOD int OSXMLEncodeBase::endElement ( const OSUTF8CHAR *  elemName,
OSXMLNamespace *  pNS = 0 
)

This method encodes an end element tag value (</elemName>).

Parameters
elemNameXML element name.
pNSXML namespace information (prefix and URI).
Returns
Completion status of operation:
  • 0 = success,
  • negative return value is error.

◆ startDocument()

EXTXMLMETHOD int OSXMLEncodeBase::startDocument ( )

This method writes information to start an XML document to the encode stream.

This includes the XML header declaration.

◆ startElement()

EXTXMLMETHOD int OSXMLEncodeBase::startElement ( const OSUTF8CHAR *  elemName,
OSXMLNamespace *  pNS = 0,
OSRTDList *  pNSAttrs = 0,
OSBOOL  terminate = FALSE 
)

This method writes information to start an XML element to the encode stream.

It can leave the element open so that attributes can be added.

Parameters
elemNameXML element name.
pNSXML namespace information (prefix and URI). If the prefix is NULL, this method will search the context's namespace stack for a prefix to use.
pNSAttrsList of namespace attributes to be added to element.
terminateAdd closing '>' character.
Returns
Completion status of operation:
  • 0 = success,
  • negative return value is error.

◆ termStartElement()

EXTXMLMETHOD int OSXMLEncodeBase::termStartElement ( )

This metod terminates a currently open XML start element by adding either a '>' or '/>' (if empty) terminator.

It will also add XSI attributes to the element. Note that is important to use this method to terminate the element rather than writng a closing angle bracket text to the stream directly due to the way state is maintained in the context.

Returns
Completion status of operation:
  • 0 = success,
  • negative return value is error.

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