Xalan-C++ API Reference  1.12.0
Typedefs | Functions | Variables
XalanCAPI.h File Reference
#include <xalanc/XalanTransformer/XalanTransformerDefinitions.hpp>
Include dependency graph for XalanCAPI.h:

Go to the source code of this file.

Typedefs

typedef void * XalanHandle
 This is a simple C interface for the class XalanTransformer. More...
 
typedef XMLCh XalanUTF16Char
 This is a typedef for characters encoded in UTF-16. More...
 

Functions

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

Variables

const typedef void * XalanCSSHandle
 Handle used to store the address of Compiled Stylesheet instance. More...
 
const typedef void * XalanPSHandle
 Handle used to store the address of Parsed Source instance. More...
 
const typedef char * XalanCCharPtr
 This is a typedef to work around limitations with the XALAN_TRANSFORMER_EXPORT_FUNCTION macro. More...
 

Typedef Documentation

◆ XalanHandle

typedef void* XalanHandle

This is a simple C interface for the class XalanTransformer.

It's the user's responsibility to call XalanInitialize() before making any other API calls, and to call XalanTerminate() when finished with the API.

After calling XalanTransformToData or XalanTransformToDataCSS, the user
should call XalanFreeData to release the memory allocated by that operation. Handle used to store the address of XalanTransformer instance.

Definition at line 45 of file XalanCAPI.h.

◆ XalanUTF16Char

typedef XMLCh XalanUTF16Char

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

Definition at line 66 of file XalanCAPI.h.

Function Documentation

◆ CreateXalanTransformer()

CreateXalanTransformer ( )

Create a XalanTransformer instance.

Returns
the XalanTransformer handle

◆ DeleteXalanTransformer()

DeleteXalanTransformer ( XalanHandle  theXalanHandle)

Delete a XalanTransformer instance.

Parameters
theXalanHandleThe XalanTransformer to destroy.

◆ XalanClearStylesheetParams()

XalanClearStylesheetParams ( XalanHandle  theXalanHandle)

Clear the top-level stylesheet parameters.

Top-level stylesheet parameters are sticky. When set, they can be used for multiple transformations. Use the XalanClearStylesheetParams function to clear or reset the top-level stylesheet parameters.

Parameters
theXalanHandlehandle of the XalanTransformer instance.

◆ XalanCompileStylesheet()

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

Creates a compiled stylesheet.

Parameters
theXSLFileNameThe file name of stylesheet source
theXalanHandleThe handle of XalanTransformer instance.
theCSSHandlea pointer to a XalanCSSHandle
Returns
0 for success.

◆ XalanCompileStylesheetFromStream()

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

Creates a compiled stylesheet.

Parameters
theXSLFileNameThe stream that contains the stylesheet xml
theXSLStreamLengthThe length of the stream.
theXalanHandlehandle of XalanTransformer instance.
theCSSHandlea pointer to a XalanCSSHandle
Returns
0 for success.

◆ XalanDestroyCompiledStylesheet()

XalanDestroyCompiledStylesheet ( XalanCSSHandle  theCSSHandle,
XalanHandle  theXalanHandle 
)

Destroys a compiled stylesheet.

Parameters
theCSSHandleThe handle of the compiled stylesheet.
theXalanHandleThe handle of XalanTransformer instance.
Returns
0 for success

◆ XalanDestroyParsedSource()

XalanDestroyParsedSource ( XalanPSHandle  thePSHandle,
XalanHandle  theXalanHandle 
)

Destroys a parsed source.

a file name, a stream or a root node.

Parameters
thePSHandleThe handle of parsed source
theXalanHandleThe handle of XalanTransformer instance.
Returns
0 for success

◆ XalanFreeData()

XalanFreeData ( char *  theData)

Free memory allocated as a result of calling XalanTransformToData.

Parameters
theDataThe address of character data.

◆ XalanGetLastError()

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()

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()

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

Parse source document.

Parameters
theXMLFileNameThe name of the file containing the source document
theXalanHandleThe handle of XalanTransformer instance.
thePSHandleA pointer to a XalanPSHandle
Returns
0 for success.

◆ XalanParseSourceFromStream()

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

Parse source document from a stream.

Parameters
theXMLStreamThe stream that contains the source xml
theXSLStreamLengthThe length of the stream
theXalanHandleThe handle of XalanTransformer instance
thePSHandleA pointer to a XalanPSHandle
Returns
0 for success.

◆ XalanSetStylesheetParam()

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
keyThe name of the param
expressionThe expression that will be evaluated
theXalanHandleThe handle of XalanTransformer instance.

◆ XalanSetStylesheetParamNodeset()

XalanSetStylesheetParamNodeset ( const char *  key,
XalanPSHandle  theNodeset,
XalanHandle  theXalanHandle 
)

Set a top-level stylesheet nodeset parameter.

This value can be evaluated via xsl:param-variable. The value is a parsed document.

Parameters
keyname of the param
theNodeseta preparsed document
theXalanHandlehandle of the XalanTransformer instance.

◆ XalanSetStylesheetParamNumber()

XalanSetStylesheetParamNumber ( const char *  key,
double  theNumber,
XalanHandle  theXalanHandle 
)

Set a top-level stylesheet number parameter.

This value can be evaluated via xsl:param-variable. The value is a parsed document.

Parameters
keyname of the param
theNumbera double floating point number
theXalanHandlehandle of the XalanTransformer instance.

◆ XalanSetStylesheetParamUTF()

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
keyname of the param
expressionexpression that will be evaluated
theXalanHandlehandle of XalanTransformer instance.

◆ XalanSetStylesheetParamUTFNodeset()

XalanSetStylesheetParamUTFNodeset ( const XalanUTF16Char key,
XalanPSHandle  theNodeset,
XalanHandle  theXalanHandle 
)

Set a top-level stylesheet nodeset parameter.

This value can be evaluated via xsl:param-variable. The value is a parsed document. The key name is a UTF-16 string.

Parameters
keyname of the param
theNodeseta preparsed document
theXalanHandlehandle of the XalanTransformer instance.

◆ XalanSetStylesheetParamUTFNumber()

XalanSetStylesheetParamUTFNumber ( const XalanUTF16Char key,
double  theNumber,
XalanHandle  theXalanHandle 
)

Set a top-level stylesheet number parameter.

This value can be evaluated via xsl:param-variable. The value is a parsed document. The key name is a UTF-16 string.

Parameters
keyname of the param
theNumbera double floating point number
theXalanHandlehandle of the XalanTransformer instance.

◆ XalanTerminate()

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
fCleanUpICUIf true, call the ICU clean up function.

◆ XalanTransformToData()

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 this pointer to free the memory.

Parameters
theXMLFileNameThe file name of the XML document.
theXSLFileNameThe file name of the stylesheet XML document.
theOutputa pointer to a char*
theXalanHandlehandle of XalanTransformer instance.
Returns
0 for success

◆ XalanTransformToDataPrebuilt()

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 this pointer to free the memory.

Parameters
theParsedSourceThe handle of a parsed source
theCSSHandleThe handle of compiled stylesheet
theOutputa pointer to a char*
theXalanHandlehandle of XalanTransformer instance.
Returns
0 for success

◆ XalanTransformToFile()

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
theXMLFileNameThe file name of the XML document.
theXSLFileNameThe file name of the stylesheet XML document.
theOutFileNameThe file name for the output.
theXalanHandleThe handle of a XalanTransformer instance.
Returns
0 for success

◆ XalanTransformToFilePrebuilt()

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
theParsedSourceThe handle of a parsed source
theCSSHandleThe handle of a compiled stylesheet
theOutFileNameThe file name for the output.
theXalanHandleThe handle of a XalanTransformer instance.
Returns
0 for success

◆ XalanTransformToHandler()

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
theXMLFileNameThe file name of XML input source
theXSLFileNameThe file name of stylesheet source
theXalanHandleThe handle of a XalanTransformer instance.
theOutputHandleA void pointer passed through to callback.
theOutputHandlerA user-defined callback function pointer.
theFlushHandlerA user-defined callback function pointer, which can be null.
Returns
0 for success

◆ XalanTransformToHandlerPrebuilt()

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
thePSHandleThe handle of parsed source
theCSSHandleThe handle of compiled stylesheet
theXalanHandleThe handle of XalanTransformer instance.
theOutputHandleA void pointer passed through to callback.
theOutputHandlerA user-defined callback function pointer.
theFlushHandlerA user-defined callback function pointer, which can be null.
Returns
0 for success

Variable Documentation

◆ XalanCCharPtr

const typedef char* XalanCCharPtr

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

Definition at line 61 of file XalanCAPI.h.

◆ XalanCSSHandle

const typedef void* XalanCSSHandle

Handle used to store the address of Compiled Stylesheet instance.

Definition at line 50 of file XalanCAPI.h.

◆ XalanPSHandle

const typedef void* XalanPSHandle

Handle used to store the address of Parsed Source instance.

Definition at line 55 of file XalanCAPI.h.