Home > Support > Documentation

rtEXIEncoder.h File Reference

EXI low-level C encode functions. More...

#include "rtexisrc/osrtexi.h"

Go to the source code of this file.


Defines

#define rtEXIEncEventCode1(pctxt, name, part1, nbits1)   rtEXIEncEventCode (pctxt, name, part1, -1, -1, nbits1, 0, 0)
#define rtEXIEncEventCode2(pctxt, name, part1, part2, nbits1, nbits2)   rtEXIEncEventCode (pctxt, name, part1, part2, -1, nbits1, nbits2, 0)
#define RTEXIENCCHEVENT(pctxt, encfunc, value, stat)

Functions

EXTERNEXI int rtEXIEncAttribute (OSCTXT *pctxt, const OSUTF8CHAR *prefix, const OSUTF8CHAR *namespaceURI, const OSUTF8CHAR *localName, const OSUTF8CHAR *value)
 This function writes an attribute in the current element.
EXTERNEXI int rtEXIEncBinary (OSCTXT *pctxt, OSUINT32 nocts, const OSOCTET *value)
 This function encodes a binary (OCTET) string value.
EXTERNEXI int rtEXIEncBoolValue (OSCTXT *pctxt, OSBOOL value)
 This function encodes a boolean value.
EXTERNEXI int rtEXIEncComment (OSCTXT *pctxt, const OSUTF8CHAR *data)
 This function encode an XML comment.
EXTERNEXI int rtEXIEncCharacters (OSCTXT *pctxt, const OSUTF8CHAR *text)
 This function encodes a string of characters.
EXTERNEXI int rtEXIEncCharArray (OSCTXT *pctxt, const OSUTF8CHAR *text, OSUINT32 nbytes)
 This function encodes a given number of bytes from a character array or string.
EXTERNEXI int rtEXIEncDate (OSCTXT *pctxt, const OSNumDateTime *pvalue)
 This function encodes a numeric date value.
EXTERNEXI int rtEXIEncDateString (OSCTXT *pctxt, const OSUTF8CHAR *pvalue)
 This function encodes a date string value.
EXTERNEXI int rtEXIEncDTD (OSCTXT *pctxt, const OSUTF8CHAR *name, const OSUTF8CHAR *publix, const OSUTF8CHAR *system, const OSUTF8CHAR *text)
 This function encodes a DTD declaration.
EXTERNEXI int rtEXIEncEndDocument (OSCTXT *pctxt)
 This function writes an end document event.
EXTERNEXI int rtEXIEncEndElement (OSCTXT *pctxt)
 This function writes an end element event.
EXTERNEXI int rtEXIEncEntityRef (OSCTXT *pctxt, const OSUTF8CHAR *name)
 This function writes an XML entity reference.
EXTERNEXI int rtEXIEncEventCode (OSCTXT *pctxt, const char *name, OSINT32 part1, OSINT32 part2, OSINT32 part3, OSUINT32 nbits1, OSUINT32 nbits2, OSUINT32 nbits3)
 This function writes an event code using the given bit field sizes.
EXTERNEXI int rtEXIEncIntCHEvent (OSCTXT *pctxt, OSINT32 value)
 This function encodes a variable of the XSD integer type as a CH content event.
EXTERNEXI int rtEXIEncIntElem (OSCTXT *pctxt, OSINT32 value, const OSUTF8CHAR *elemName, OSXMLNamespace *pNS)
 This function encodes a complete XML element (<tag>content</tag>) in which the content is a signed integer.
EXTERNEXI int rtEXIEncIntValue (OSCTXT *pctxt, OSINT32 value)
 This function encodes a variable of the XSD integer type.
EXTERNEXI int rtEXIEncNBitUIntValue (OSCTXT *pctxt, OSUINT32 value, OSUINT32 nbits)
 This function encodes an unsigned integer value in a bit field of the given width.
EXTERNEXI int rtEXIEncNamespace (OSCTXT *pctxt, const OSUTF8CHAR *prefix, const OSUTF8CHAR *namespaceURI, OSBOOL indicator)
 This function encodes a namespace declaration.
EXTERNEXI int rtEXIEncProcessingInstruction (OSCTXT *pctxt, const OSUTF8CHAR *target, const OSUTF8CHAR *data)
 This function writes an XML processing instruction.
EXTERNEXI int rtEXIEncStartDocument (OSCTXT *pctxt)
 This function writes a start document event.
EXTERNEXI int rtEXIEncStartElement (OSCTXT *pctxt, const OSUTF8CHAR *elemName, OSXMLNamespace *pNS)
 This function writes a start element event.
EXTERNEXI int rtEXIEncString (OSCTXT *pctxt, const OSUTF8CHAR *value, const OSXMLFullQName *pqname)
 This function encodes a character string value.
EXTERNEXI int rtEXIEncStringCHEvent (OSCTXT *pctxt, const OSUTF8CHAR *value, const OSXMLFullQName *pqname)
 This function encodes a character string value as a CH content event.
EXTERNEXI int rtEXIEncStringElem (OSCTXT *pctxt, OSXMLSTRING *pxmlstr, const OSUTF8CHAR *elemName, OSXMLNamespace *pNS)
 This function encodes a complete XML element (<tag>content</tag>) in which the content is a string.
EXTERNEXI int rtEXIEncUIntCHEvent (OSCTXT *pctxt, OSUINT32 value)
 This function encodes a variable of the XSD unsigned integer type as a CH content event.
EXTERNEXI int rtEXIEncUIntElem (OSCTXT *pctxt, OSUINT32 value, const OSUTF8CHAR *elemName, OSXMLNamespace *pNS)
 This function encodes a complete XML element (<tag>content</tag>) in which the content is an unsigned integer.
EXTERNEXI int rtEXIEncUIntValue (OSCTXT *pctxt, OSUINT32 value)
 This function encodes an unsigned integer value.
EXTERNEXI int rtEXIEncUTF8Str (OSCTXT *pctxt, const OSUTF8CHAR *value, size_t lengthIncr)
 This function encodes a UTF-8 character string value.

Detailed Description

EXI low-level C encode functions.

Definition in file rtEXIEncoder.h.


Function Documentation

EXTERNEXI int rtEXIEncAttribute OSCTXT *  pctxt,
const OSUTF8CHAR *  prefix,
const OSUTF8CHAR *  namespaceURI,
const OSUTF8CHAR *  localName,
const OSUTF8CHAR *  value
 

This function writes an attribute in the current element.

Parameters:
pctxt Pointer to OSCTXT structure
prefix The attribute's prefix or empty (null or "") for no prefix.
namespaceURI The attribute's namespace URI or empty for the default namespace.
localName The attribute's local name which must be a non-empty string.
value The attributes's value which must be non-null.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncBinary OSCTXT *  pctxt,
OSUINT32  nocts,
const OSOCTET *  value
 

This function encodes a binary (OCTET) string value.

Parameters:
pctxt Pointer to context block structure.
nocts Number of octets in value
value Pointer to string of octets to be encoded.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncBoolValue OSCTXT *  pctxt,
OSBOOL  value
 

This function encodes a boolean value.

Parameters:
pctxt Pointer to context block structure.
value OSBOOL value.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncCharacters OSCTXT *  pctxt,
const OSUTF8CHAR *  text
 

This function encodes a string of characters.

Parameters:
pctxt Pointer to context block structure.
text Pointer to text to be encoded.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncCharArray OSCTXT *  pctxt,
const OSUTF8CHAR *  text,
OSUINT32  nbytes
 

This function encodes a given number of bytes from a character array or string.

This function may be used from within a SAX characters handler when the string is not null-terminated.

Parameters:
pctxt Pointer to context block structure.
text Pointer to text to be encoded.
nbytes Number of bytes to encode.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncComment OSCTXT *  pctxt,
const OSUTF8CHAR *  data
 

This function encode an XML comment.

Parameters:
pctxt Pointer to context block structure.
data The comment to be encoded
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncDate OSCTXT *  pctxt,
const OSNumDateTime *  pvalue
 

This function encodes a numeric date value.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to numeric date/time stricture.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncDateString OSCTXT *  pctxt,
const OSUTF8CHAR *  pvalue
 

This function encodes a date string value.

Parameters:
pctxt Pointer to context block structure.
pvalue Date string to be encoded
  • The format of date is CCYY-MM-DD
  • The value of CCYY is from 0000-9999
  • The value of MM is 01 - 12
  • The value of DD is 01 - XX (where XX is the Days in MM month in CCYY year)
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncDTD OSCTXT *  pctxt,
const OSUTF8CHAR *  name,
const OSUTF8CHAR *  publix,
const OSUTF8CHAR *  system,
const OSUTF8CHAR *  text
 

This function encodes a DTD declaration.

Parameters:
pctxt Pointer to context block structure.
name The DTD's root element.
publix The DTD's public identifier.
system The DTD's system identifier.
text The DTD's textual representation.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncEndDocument OSCTXT *  pctxt  ) 
 

This function writes an end document event.

Parameters:
pctxt Pointer to context block structure.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncEndElement OSCTXT *  pctxt  ) 
 

This function writes an end element event.

Parameters:
pctxt Pointer to context block structure.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncEntityRef OSCTXT *  pctxt,
const OSUTF8CHAR *  name
 

This function writes an XML entity reference.

Parameters:
pctxt Pointer to context block structure.
name The entity's name.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncEventCode OSCTXT *  pctxt,
const char *  name,
OSINT32  part1,
OSINT32  part2,
OSINT32  part3,
OSUINT32  nbits1,
OSUINT32  nbits2,
OSUINT32  nbits3
 

This function writes an event code using the given bit field sizes.

Parameters:
pctxt Pointer to context block structure.
name Textual name of event (for example, "SE(*)")
part1 Part 1 of event code. -1 if not used.
part2 Part 2 of event code. -1 if not used.
part3 Part 3 of event code. -1 if not used.
nbits1 Length of bit field for part 1.
nbits2 Length of bit field for part 2.
nbits3 Length of bit field for part 3.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncIntCHEvent OSCTXT *  pctxt,
OSINT32  value
 

This function encodes a variable of the XSD integer type as a CH content event.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncIntElem OSCTXT *  pctxt,
OSINT32  value,
const OSUTF8CHAR *  elemName,
OSXMLNamespace *  pNS
 

This function encodes a complete XML element (<tag>content</tag>) in which the content is a signed integer.

Parameters:
pctxt Pointer to context block structure.
value Integer value to be encoded.
elemName Local name of element.
pNS Pointer to namespace structure containing prefix, and namespace URI.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncIntValue OSCTXT *  pctxt,
OSINT32  value
 

This function encodes a variable of the XSD integer type.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncNamespace OSCTXT *  pctxt,
const OSUTF8CHAR *  prefix,
const OSUTF8CHAR *  namespaceURI,
OSBOOL  indicator
 

This function encodes a namespace declaration.

If the "preserve prefixes" option is set to false, nothing is written.

Parameters:
pctxt Pointer to context block structure.
prefix The non-empty prefix being declared.
namespaceURI The namespace associated with the prefix.
indicator Indicator bit used to indicate this namespace prefix is associated with last encoded element QName.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncNBitUIntValue OSCTXT *  pctxt,
OSUINT32  value,
OSUINT32  nbits
 

This function encodes an unsigned integer value in a bit field of the given width.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
nbits Size of bit field.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncProcessingInstruction OSCTXT *  pctxt,
const OSUTF8CHAR *  target,
const OSUTF8CHAR *  data
 

This function writes an XML processing instruction.

Parameters:
pctxt Pointer to context block structure.
target The PI's target.
data The PI's data.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncStartDocument OSCTXT *  pctxt  ) 
 

This function writes a start document event.

This method must be called before writing a document or a fragment.

Parameters:
pctxt Pointer to context block structure.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncStartElement OSCTXT *  pctxt,
const OSUTF8CHAR *  elemName,
OSXMLNamespace *  pNS
 

This function writes a start element event.

If this method is called before rtEXIEncStartDocument, then the encoder assumes a fragment is being written.

Parameters:
pctxt Pointer to context block structure.
elemName The non-empty element name.
pNS Pointer to namespace structure containing prefix, and namespace URI.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncString OSCTXT *  pctxt,
const OSUTF8CHAR *  value,
const OSXMLFullQName *  pqname
 

This function encodes a character string value.

It uses the string tables to determine if the actual string value should be encoded or not.

Parameters:
pctxt Pointer to context block structure.
value Pointer to string value to be encoded.
pqname Pointer to a QName structure containing localName, prefix, and namespace URI.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncStringCHEvent OSCTXT *  pctxt,
const OSUTF8CHAR *  value,
const OSXMLFullQName *  pqname
 

This function encodes a character string value as a CH content event.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncStringElem OSCTXT *  pctxt,
OSXMLSTRING *  pxmlstr,
const OSUTF8CHAR *  elemName,
OSXMLNamespace *  pNS
 

This function encodes a complete XML element (<tag>content</tag>) in which the content is a string.

Parameters:
pctxt Pointer to context block structure.
pxmlstr Pointer to string value to be encoded.
elemName Local name of element.
pNS Pointer to namespace structure containing prefix, and namespace URI.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncUIntCHEvent OSCTXT *  pctxt,
OSUINT32  value
 

This function encodes a variable of the XSD unsigned integer type as a CH content event.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncUIntElem OSCTXT *  pctxt,
OSUINT32  value,
const OSUTF8CHAR *  elemName,
OSXMLNamespace *  pNS
 

This function encodes a complete XML element (<tag>content</tag>) in which the content is an unsigned integer.

Parameters:
pctxt Pointer to context block structure.
value Integer value to be encoded.
elemName Local name of element.
pNS Pointer to namespace structure containing prefix, and namespace URI.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncUIntValue OSCTXT *  pctxt,
OSUINT32  value
 

This function encodes an unsigned integer value.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNEXI int rtEXIEncUTF8Str OSCTXT *  pctxt,
const OSUTF8CHAR *  value,
size_t  lengthIncr
 

This function encodes a UTF-8 character string value.

It does not use the string tables to determine if the actual string value should be encoded or not (i.e. it directly encodes the content).

Parameters:
pctxt Pointer to context block structure.
value Pointer to string value to be encoded.
lengthIncr Value to be added to string length before encoding. This value is normally zero; however, some string table operations require an increment of 1 or 2.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.