## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.9

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

# XalanCAPI.h File Reference

Include dependency graph for XalanCAPI.h:

Go to the source code of this file.

## Defines

- #define XALAN_CAPI_HEADER_GUARD_1357924680

## Typedefs

- typedef void * XalanHandle
    Handle used to store the address of XalanTransformer instance.
- typedef const void * XalanCSSHandle
    Handle used to store the address of Compiled Stylesheet instance.
- typedef const void * XalanPSHandle
    Handle used to store the address of Parsed Source instance.
- typedef const char * XalanCCharPtr
    This is a typedef to work around limitations with the XALAN_TRANSFORMER_EXPORT_FUNCTION macro.
- typedef unsigned short XalanUTF16Char
    This is a typedef for characters encoded in UTF-16.

## Functions

- XalanInitialize (void)
    Initialize Xerces and Xalan.
- XalanTerminate (int fCleanUpICU)
    Terminate Xalan and Xerces.
- CreateXalanTransformer ()
    Create a XalanTransformer instance.
- DeleteXalanTransformer (XalanHandle theXalanHandle)
    Delete a XalanTransformer instance.
- XalanTransformToFile (const char *theXMLFileName, const char *theXSLFileName, const char *theOutFileName, XalanHandle theXalanHandle)
    Transform the XML source tree to the given result file.
- XalanTransformToFilePrebuilt (XalanPSHandle theParsedSource, XalanCSSHandle theCSSHandle, const char *theOutFileName, XalanHandle theXalanHandle)
    Transform the XML source tree to the given result file.
- XalanTransformToData (const char *theXMLFileName, const char *theXSLFileName, char **theOutput, XalanHandle theXalanHandle)
    Transform the XML source tree to a dynamically allocated buffer.
- XalanTransformToDataPrebuilt (XalanPSHandle theParsedSource, XalanCSSHandle theCSSHandle, char **theOutput, XalanHandle theXalanHandle)
    Transform the XML source tree to a dynamically allocated buffer.
- XalanFreeData (char *theData)
    Free memory allocated as a result of calling XalanTransformToData.
- XalanTransformToHandler (const char *theXMLFileName, const char *theXSLFileName, XalanHandle theXalanHandle, void *theOutputHandle, XalanOutputHandlerType theOutputHandler, XalanFlushHandlerType theFlushHandler)
    Transform the XML source tree to a callback function.
- XalanTransformToHandlerPrebuilt (XalanPSHandle thePSHandle, XalanCSSHandle theCSSHandle, XalanHandle theXalanHandle, void *theOutputHandle, XalanOutputHandlerType theOutputHandler, XalanFlushHandlerType theFlushHandler)
    Transform the XML source tree to a callback function.
- XalanCompileStylesheet (const char *theXSLFileName, XalanHandle theXalanHandle, XalanCSSHandle *theCSSHandle)
    Creates a compiled stylesheet.
- XalanCompileStylesheetFromStream (const char *theXSLStream, unsigned long theXSLStreamLength, XalanHandle theXalanHandle, XalanCSSHandle *theCSSHandle)
    Creates a compiled stylesheet.
- XalanDestroyCompiledStylesheet (XalanCSSHandle theCSSHandle, XalanHandle theXalanHandle)
    Destroys a compiled stylesheet.
- XalanParseSource (const char *theXMLFileName, XalanHandle theXalanHandle, XalanPSHandle *thePSHandle)
    Parse source document.
- XalanParseSourceFromStream (const char *theXMLStream, unsigned long theXMLStreamLength, XalanHandle theXalanHandle, XalanPSHandle *thePSHandle)
    Parse source document from a stream.
- XalanDestroyParsedSource (XalanPSHandle thePSHandle, XalanHandle theXalanHandle)
    Destroys a parsed source.
- XalanSetStylesheetParam (const char *key, const char *expression, XalanHandle theXalanHandle)
    Set a top-level stylesheet parameter.
- XalanSetStylesheetParamUTF (const XalanUTF16Char *key, const XalanUTF16Char *expression, XalanHandle theXalanHandle)
    Set a top-level stylesheet parameter.
- XalanGetLastError (XalanHandle theXalanHandle)
    Returns the last error that occurred as a result of calling transform.

## Define Documentation

#define XALAN_CAPI_HEADER_GUARD_1357924680

## Typedef Documentation

typedef const char* XalanCCharPtr

| This is a typedef to work around limitations with the XALAN_TRANSFORMER_EXPORT_FUNCTION macro.

typedef const void* XalanCSSHandle

| Handle used to store the address of Compiled Stylesheet instance.

typedef void* XalanHandle

| Handle used to store the address of XalanTransformer instance.

typedef const void* XalanPSHandle

| Handle used to store the address of Parsed Source instance.

typedef unsigned short XalanUTF16Char

| This is a typedef for characters encoded in UTF-16.

## Function Documentation

CreateXalanTransformer | ( |  | ) |

Create a XalanTransformer instance.

Returns:
  the XalanTransformer handle

DeleteXalanTransformer | ( | XalanHandle | theXalanHandle | ) |

Delete a XalanTransformer instance.

Parameters:

  theXalanHandle | The XalanTransformer to destroy.

XalanCompileStylesheet | ( | const char * | theXSLFileName,
|  | XalanHandle | theXalanHandle,
|  | XalanCSSHandle * | theCSSHandle
| ) |

Creates a compiled stylesheet.

Parameters:

  theXSLFileName | filename of stylesheet source
  theXalanHandle | handle of XalanTransformer instance.
  theCSSHandle | a pointer to a XalanCSSHandle

Returns:
  0 for success.

XalanCompileStylesheetFromStream | ( | const char * | theXSLStream,
|  | unsigned long | theXSLStreamLength,
|  | XalanHandle | theXalanHandle,
|  | XalanCSSHandle * | theCSSHandle
| ) |

Creates a compiled stylesheet.

Parameters:

  theXSLFileName | The stream that contains the stylesheet xml
  theXSLStreamLength | The length of the stream.
  theXalanHandle | handle of XalanTransformer instance.
  theCSSHandle | a pointer to a XalanCSSHandle

Returns:
  0 for success.

XalanDestroyCompiledStylesheet | ( | XalanCSSHandle | theCSSHandle,
|  | XalanHandle | theXalanHandle
| ) |

Destroys a compiled stylesheet.

Parameters:

  theCSSHandle | handle of the compiled stylesheet
  theXalanHandle | handle of XalanTransformer instance.

Returns:
  0 for success

XalanDestroyParsedSource | ( | XalanPSHandle | thePSHandle,
|  | XalanHandle | theXalanHandle
| ) |

Destroys a parsed source.

a file name, a stream or a root node.

Parameters:

  thePSHandle | handle of parsed source
  theXalanHandle | handle of XalanTransformer instance.

Returns:
  0 for success

XalanFreeData | ( | char * | theData | ) |

Free memory allocated as a result of calling XalanTransformToData.

Parameters:

  theData | The address of character data.

XalanGetLastError | ( | XalanHandle | theXalanHandle | ) |

Returns the last error that occurred as a result of calling transform.

The signature for following function is really: const char* XalanGetLastError(XalanHandle theXalanHandle) const;

Returns:
  error message const character pointer.

XalanInitialize | ( | void |  | ) |

Initialize Xerces and Xalan.

Should be called only once per process before making any other API calls.

Returns:
  0 if successful, -1 if initialization fails.

XalanParseSource | ( | const char * | theXMLFileName,
|  | XalanHandle | theXalanHandle,
|  | XalanPSHandle * | thePSHandle
| ) |

Parse source document.

Parameters:

  theXMLFileName | The name of the file containing the source document.
  theXalanHandle | The handle of XalanTransformer instance.
  thePSHandle | A pointer to a XalanPSHandle

Returns:
  0 for success.

XalanParseSourceFromStream | ( | const char * | theXMLStream,
|  | unsigned long | theXMLStreamLength,
|  | XalanHandle | theXalanHandle,
|  | XalanPSHandle * | thePSHandle
| ) |

Parse source document from a stream.

Parameters:

  theXMLStream | The stream that contains the source xml
  theXSLStreamLength | The length of the stream.
  theXalanHandle | The handle of XalanTransformer instance.
  thePSHandle | A pointer to a XalanPSHandle

Returns:
  0 for success.

XalanSetStylesheetParam | ( | const char * | key,
|  | const char * | expression,
|  | XalanHandle | theXalanHandle
| ) |

Set a top-level stylesheet parameter.

This value can be evaluated via xsl:param-variable.

Parameters:

  key | name of the param
  expression | expression that will be evaluated
  theXalanHandle | handle of XalanTransformer instance.

XalanSetStylesheetParamUTF | ( | const XalanUTF16Char * | key,
|  | const XalanUTF16Char * | expression,
|  | XalanHandle | theXalanHandle
| ) |

Set a top-level stylesheet parameter.

This value can be evaluated via xsl:param-variable. The key and expression parameters must be encoded in UTF-16.

Parameters:

  key | name of the param
  expression | expression that will be evaluated
  theXalanHandle | handle of XalanTransformer instance.

XalanTerminate | ( | int | fCleanUpICU | ) |

Terminate Xalan and Xerces.

Should be called only once per process after deleting all instances of XalanTransformer.

Once a process has called this function, it cannot use the API until another call to XalanInitialize has been made.

Optionally, if the ICU has been integrated, this will call the ICU clean up function. This must only be done if the ICU will no longer be used by the process, since the ICU will no longer be in a usable state. See the ICU documentation for more details.

This is handy when using leak-detection software, as all static data allocated by Xalan (and optionally, the ICU) will be freed.

Parameters:

  fCleanUpICU | If true, call the ICU clean up function.

XalanTransformToData | ( | const char * | theXMLFileName,
|  | const char * | theXSLFileName,
|  | char ** | theOutput,
|  | XalanHandle | theXalanHandle
| ) |

Transform the XML source tree to a dynamically allocated buffer.

The processor will apply the stylesheet file to the input file and assign the address of the dynamically allocated result to a user supplied pointer. The user must call XalanFreeData with the this pointer.

Parameters:

  theXMLFileName | filename of XML input source
  theXSLFileName | filename of stylesheet source
  theOutput | a pointer to a char*
  theXalanHandle | handle of XalanTransformer instance.

Returns:
  0 for success

XalanTransformToDataPrebuilt | ( | XalanPSHandle | theParsedSource,
|  | XalanCSSHandle | theCSSHandle,
|  | char ** | theOutput,
|  | XalanHandle | theXalanHandle
| ) |

Transform the XML source tree to a dynamically allocated buffer.

The processor will apply the compiled stylesheet to the input file and assign the address of the dynamically allocated result to a user supplied pointer. The user must call XalanFreeData with the this pointer.

Parameters:

  theXMLFileName | filename of XML input source
  theCSSHandle | handle of compiled stylesheet
  theOutput | a pointer to a char*
  theXalanHandle | handle of XalanTransformer instance.

Returns:
  0 for success

XalanTransformToFile | ( | const char * | theXMLFileName,
|  | const char * | theXSLFileName,
|  | const char * | theOutFileName,
|  | XalanHandle | theXalanHandle
| ) |

Transform the XML source tree to the given result file.

The processor will apply the stylesheet file to the input file and write the transformation result to a new output file.

Parameters:

  theXMLFileName | filename of XML input source
  theXSLFileName | filename of stylesheet source
  theOutFileName | filename of output source
  theXalanHandle | handle of XalanTransformer instance.

Returns:
  0 for success

XalanTransformToFilePrebuilt | ( | XalanPSHandle | theParsedSource,
|  | XalanCSSHandle | theCSSHandle,
|  | const char * | theOutFileName,
|  | XalanHandle | theXalanHandle
| ) |

Transform the XML source tree to the given result file.

The processor will apply the compiled stylesheet to the input file and write the transformation result to a new output file.

Parameters:

  theParsedSource | handle of parsed source
  theCSSHandle | handle of compiled stylesheet
  theOutFileName | filename of output source
  theXalanHandle | handle of XalanTransformer instance.

Returns:
  0 for success

XalanTransformToHandler | ( | const char * | theXMLFileName,
|  | const char * | theXSLFileName,
|  | XalanHandle | theXalanHandle,
|  | void * | theOutputHandle,
|  | XalanOutputHandlerType | theOutputHandler,
|  | XalanFlushHandlerType | theFlushHandler
| ) |

Transform the XML source tree to a callback function.

The processor will apply the stylesheet file to the input file and allocate the transformation result to a callback function in pre-allocated blocks. Once the transformation is complete, a second callback, to flush the buffer, is called. You can pass in NULL if you do not wish to implement a flush callback. Xalan will release any memory allocated upon termination, and data passed to the callback is not guaranteed to be null terminated.

See XalanTransformerDefinitions.hpp for more details.

Parameters:

  theXMLFileName | filename of XML input source
  theXSLFileName | filename of stylesheet source
  theXalanHandle | handle of XalanTransformer instance.
  theOutputHandle | void pointer passed through to callback.
  theOutputHandler | a user defined (callback) function.
  theFlushHandler | (can be NULL) a user defined (callback) function.

Returns:
  0 for success

XalanTransformToHandlerPrebuilt | ( | XalanPSHandle | thePSHandle,
|  | XalanCSSHandle | theCSSHandle,
|  | XalanHandle | theXalanHandle,
|  | void * | theOutputHandle,
|  | XalanOutputHandlerType | theOutputHandler,
|  | XalanFlushHandlerType | theFlushHandler
| ) |

Transform the XML source tree to a callback function.

The processor will apply the compiled stylesheet to the input file and allocate the transformation result to a callback function in pre-allocated blocks. Once the transformation is complete, a second callback, to flush the buffer, is called. You can pass in NULL if you do not wish to implement a flush callback. Xalan will release any memory allocated upon termination, and data passed to the callback is not guaranteed to be null terminated.

See XalanTransformerDefinitions.hpp for more details.

Parameters:

  thePSHandle | handle of parsed source
  theCSSHandle | handle of compiled stylesheet
  theXalanHandle | handle of XalanTransformer instance.
  theOutputHandle | void pointer passed through to callback.
  theOutputHandler | a user defined (callback) function.
  theFlushHandler | (can be NULL) a user defined (callback) function.

Returns:
  0 for success

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.9 Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.