From 53914f770f1e1dc1ab4342c64846fd995825b7e6 Mon Sep 17 00:00:00 2001 From: Stef Date: Wed, 17 Sep 2003 18:34:42 +0000 Subject: Initial Import --- win32/sablot/include/sabdbg.h | 58 +++ win32/sablot/include/sablot.h | 560 ++++++++++++++++++++++++ win32/sablot/include/sablot.lib | Bin 0 -> 28044 bytes win32/sablot/include/sdom.h | 921 ++++++++++++++++++++++++++++++++++++++++ win32/sablot/include/shandler.h | 369 ++++++++++++++++ win32/sablot/include/sxpath.h | 264 ++++++++++++ 6 files changed, 2172 insertions(+) create mode 100644 win32/sablot/include/sabdbg.h create mode 100644 win32/sablot/include/sablot.h create mode 100644 win32/sablot/include/sablot.lib create mode 100644 win32/sablot/include/sdom.h create mode 100644 win32/sablot/include/shandler.h create mode 100644 win32/sablot/include/sxpath.h (limited to 'win32/sablot/include') diff --git a/win32/sablot/include/sabdbg.h b/win32/sablot/include/sabdbg.h new file mode 100644 index 0000000..1428af6 --- /dev/null +++ b/win32/sablot/include/sabdbg.h @@ -0,0 +1,58 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Sablotron XSLT Processor. + * + * The Initial Developer of the Original Code is Ginger Alliance Ltd. + * Portions created by Ginger Alliance are Copyright (C) 2000-2002 + * Ginger Alliance Ltd. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + */ + +#ifndef SabdbgHIncl +#define SabdbgHIncl + +#define SablotAsExport +#include + +/************************************************************/ +/* DEBUGGER stuff */ +/************************************************************/ + +Declare +( + void debuggerInit(); +) + +Declare +( + void debuggerDone(); +) + +Declare +( + void debuggerEnterIdle(); +) + +#endif diff --git a/win32/sablot/include/sablot.h b/win32/sablot/include/sablot.h new file mode 100644 index 0000000..71b05a2 --- /dev/null +++ b/win32/sablot/include/sablot.h @@ -0,0 +1,560 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Sablotron XSLT Processor. + * + * The Initial Developer of the Original Code is Ginger Alliance Ltd. + * Portions created by Ginger Alliance are Copyright (C) 2000-2002 + * Ginger Alliance Ltd. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + */ + +/* +sablot.h +TK Dec 14, 99 +header file for Sablot.cpp +*/ + +#ifndef SablotHIncl +#define SablotHIncl + + +/* version info */ +#define SAB_VERSION "0.96" +#define SAB_DATE "Sep 5, 2002" + +/* common types */ +typedef void *SablotHandle; +typedef void *SDOM_Document; +typedef void *SablotSituation; + +#if defined(WIN32) && defined(_MSC_VER) +#if defined(SablotAsExport) +#define DllImpExp __declspec( dllexport ) +#else +#define DllImpExp __declspec( dllimport ) +#endif /* SablotAsExport */ +#else /* WIN32 && _MSC_VER */ +#define DllImpExp extern +#endif + +#ifdef __cplusplus +#define DeclBegin extern "C" { DllImpExp +#define DeclEnd } +#else +#define DeclBegin DllImpExp +#define DeclEnd +#endif + +#define Declare(STATEMENT) DeclBegin STATEMENT DeclEnd + +#include "shandler.h" +#include "sxpath.h" + +typedef enum +{ + SAB_NO_ERROR_REPORTING = 0x1, + SAB_PARSE_PUBLIC_ENTITIES = 0x2, + SAB_DISABLE_ADDING_META = 0x4, + SAB_DISABLE_STRIPPING = 0x8, + SAB_IGNORE_DOC_NOT_FOUND =0x10 +} SablotFlag; + +/* create a new document */ + +Declare +( + int SablotCreateDocument( + SablotSituation S, + SDOM_Document *D); +) + +/* parse in a document from the given URI */ + +Declare +( + int SablotParse( + SablotSituation S, + const char *uri, + SDOM_Document *D); +) + +/* parse a document given in an in-memory buffer */ + +Declare +( + int SablotParseBuffer( + SablotSituation S, + const char *buffer, + SDOM_Document *D); +) + +Declare +( + int SablotParseStylesheet( + SablotSituation S, + const char *uri, + SDOM_Document *D); +) + + +Declare +( + int SablotParseStylesheetBuffer( + SablotSituation S, + const char *buffer, + SDOM_Document *D); +) + + +/* lock document before using it */ + +Declare +( + int SablotLockDocument( + SablotSituation S, + SDOM_Document D); +) + +Declare +( + int SablotDestroyDocument( + SablotSituation S, + SDOM_Document D); +) + +Declare +( + int SablotAddParam( + SablotSituation S, + void *processor_, + const char *paramName, + const char *paramValue); +) + +Declare +( + int SablotAddArgBuffer( + SablotSituation S, + void *processor_, + const char *argName, + const char *bufferValue); +) + +Declare( + int SablotAddArgTree( + SablotSituation S, + void *processor_, + const char *argName, + SDOM_Document tree); +) + +Declare +( + int SablotRunProcessorGen( + SablotSituation S, + void *processor_, + const char *sheetURI, + const char *inputURI, + const char *resultURI); +) + +Declare +( + int SablotRunProcessorExt( + SablotSituation S, + void *processor_, + const char *sheetURI, + const char *resultURI, + NodeHandle doc); +) + +/* + * Situation functions + */ + +/* Creates a new situation. */ + +Declare +( + int SablotCreateSituation(SablotSituation *sPtr); +) + +/* Sets situation flags. */ + +Declare +( + int SablotSetOptions(SablotSituation S, int flags); +) + +Declare +( + int SablotClearSituation(SablotSituation S); +) + +Declare +( + const char* SablotGetErrorURI(SablotSituation S); +) + +Declare +( + int SablotGetErrorLine(SablotSituation S); +) + +Declare +( + const char* SablotGetErrorMsg(SablotSituation S); +) + +/* Disposes of the situation. */ + +Declare +( + int SablotDestroySituation(SablotSituation S); +) + + +/***************************************************************** +SablotCreateProcessor +creates a new instance of the processor +*****************************************************************/ + +Declare +( + int SablotCreateProcessor(SablotHandle *processorPtr); +) + +/***************************************************************** +SablotCreateProcessorForSituation +use this instead of SablotCreateProcessor with any of the +situation-aware functions like SablotRunProcessorGen, +SablotAddArgTree etc. +*****************************************************************/ + +Declare +( + int SablotCreateProcessorForSituation(SablotSituation S, void **processorPtr); +) + + +/***************************************************************** +SablotDestroyProcessor +destroys the processor +*****************************************************************/ + +Declare +( + int SablotDestroyProcessor(SablotHandle processor_); +) + +/***************************************************************** +SablotRunProcessor +runs the existing instance on the given documents +*****************************************************************/ + +Declare +( + int SablotRunProcessor(SablotHandle processor_, + const char *sheetURI, + const char *inputURI, + const char *resultURI, + const char **params, + const char **arguments); +) + +/***************************************************************** +SablotGetResultArg +gets the result arg buffer from the last Sablot run +the buffer is identified by an URI (to enable output to + multiple documents) +*****************************************************************/ + +Declare +( + int SablotGetResultArg(SablotHandle processor_, + const char *argURI, + char **argValue); +) + +/***************************************************************** +SablotFreeResultArgs +kill all result arg buffers from the last Sablot run +*****************************************************************/ + +Declare +( + int SablotFreeResultArgs(SablotHandle processor_); +) + +/***************************************************************** +SablotRegHandler +General handler registrator. + type the type of the handler (scheme etc.) + handler pointer to the struct of callbacks of the given type + userData the user data this handler wishes to receive +*****************************************************************/ + +Declare +( + int SablotRegHandler( + SablotHandle processor_, + HandlerType type, /* HLR_MESSAGE, HLR_SCHEME, HLR_SAX */ + void *handler, + void *userData); +) + +/***************************************************************** +SablotUnregHandler + + General handler unregistrator. +*****************************************************************/ + +Declare +( + int SablotUnregHandler( + SablotHandle processor_, + HandlerType type, /* HLR_MESSAGE, HLR_SCHEME, HLR_SAX */ + void *handler, + void *userData); +) + +/***************************************************************** +SablotSetBase + + overrides the default base URI for relative reference + resolution. +*****************************************************************/ + +Declare +( + int SablotSetBase( + SablotHandle processor_, + const char *theBase); +) + +/***************************************************************** +SablotSetBaseForScheme + + a softer form of SablotSetBase: the hard base URI will only + be in effect for relative references whose bases have + the given scheme. + + Example: assume we call + SablotSetBaseForScheme( P, "arg", "http://server" ) + and then runs a stylesheet at "arg:/xxx" which contains "document('foo.xml')". + The relative reference is resolved as "http://server/foo.xml" + but if the stylesheet were at "file:/xxx" it would become "file:/foo.xml". +*****************************************************************/ + +Declare +( + int SablotSetBaseForScheme(void* processor_, + const char *scheme, + const char *base); +) + +/**************************************************************** +SablotSetLog + + sets the logging options. Logging is off by default. +*****************************************************************/ + +Declare +( + int SablotSetLog( + SablotHandle processor_, + const char *logFilename, + int logLevel); +) + + +/***************************************************************** +SablotProcess + + the main function published by Sablotron. Feeds given XML + input to a stylesheet. Both of these as well as the location for + output are identified by a URI. One can also pass top-level + stylesheet parameters and named buffers ('args'). +ARGS + sheetURI URI of the XSLT stylesheet + inputURI URI of the XML document + resultURI URI of the output document + params a NULL-terminated array of char*'s defining the top-level + parameters to be passed, interpreted as a + sequence of (name, value) pairs. + arguments a NULL-terminated array of char*'s defining the named + buffers to be passed, interpreted as a + sequence of (name, value) pairs. Both params and arguments + may be NULL. +RETURNS + . nonzero iff error + resultArg in case output goes to a named buffer, *resultArg is set to + point to it (otherwise to NULL). Free it using SablotFree(). +*****************************************************************/ + +Declare +( + int SablotProcess( + const char *sheetURI, const char *inputURI, const char *resultURI, + const char **params, const char **arguments, char **resultArg); +) + +/***************************************************************** +SablotProcessFiles + + calls SablotProcess to process files identified by their + file names. No named buffers or params are passed. Included + for backward compatibility. +ARGUMENTS + styleSheetName, inputName, resultName + file names of the stylesheet, XML input and output, + respectively. +RETURNS + . error flag +*****************************************************************/ + +Declare +( + int SablotProcessFiles( + const char *styleSheetName, + const char *inputName, + const char *resultName); +) + +/***************************************************************** +SablotProcessStrings + + calls SablotProcess to process documents in memory, passing + pointers to the documents. No named buffers or params are passed. + Included for backward compatibility. +ARGUMENTS + styleSheetStr, inputStr + text of the stylesheet and the XML input +RETURNS + . error flag + *resultStr pointer to the newly allocated block containing + the result +*****************************************************************/ + +Declare +( + int SablotProcessStrings( + const char *styleSheetStr, + const char *inputStr, + char **resultStr); +) + +/***************************************************************** +SablotProcessStringsWithBase + + Like SablotProcessStrings but lets you pass an URI that replaces + the stylesheet's URI in relative address resolution. + +ARGUMENTS + styleSheetStr, inputStr + text of the stylesheet and the XML input + theHardBase the "hard base URI" replacing the stylesheet's URI + in all relevant situations +RETURNS + . error flag + *resultStr pointer to the newly allocated block containing + the result +*****************************************************************/ + +Declare +( + int SablotProcessStringsWithBase( + const char *styleSheetStr, + const char *inputStr, + char **resultStr, + const char *theHardBase); +) + +/***************************************************************** +SablotFree + + Frees the Sablotron-allocated buffer. The user cannot free it + directly by free(). +*****************************************************************/ + +Declare +( + int SablotFree(char *resultStr); +) + +/***************************************************************** +SablotClearError + + Clears the pending error for the given instance of Sablot. +*****************************************************************/ + +Declare +( + int SablotClearError(SablotHandle processor_); +) + +/***************************************************************** +SablotGetMsgText + + Returns the text of a message with the given code. +*****************************************************************/ + +Declare +( + const char* SablotGetMsgText(int code); +) + +/***************************************************************** +SablotSetInstanceData +*****************************************************************/ + +Declare +( + void SablotSetInstanceData(SablotHandle processor_, void *idata); +) + +/***************************************************************** +SablotGetInstanceData +*****************************************************************/ + +Declare +( + void* SablotGetInstanceData(SablotHandle processor_); +) + +/* + SablotSetEncoding + sets the output encoding to be used regardless of the encoding + specified by the stylesheet + To unset, call with encoding_ NULL. +*/ + +Declare +( + void SablotSetEncoding(SablotHandle processor_, char *encoding_); +) + +#endif /* defined SablotHIncl */ + diff --git a/win32/sablot/include/sablot.lib b/win32/sablot/include/sablot.lib new file mode 100644 index 0000000..e002170 Binary files /dev/null and b/win32/sablot/include/sablot.lib differ diff --git a/win32/sablot/include/sdom.h b/win32/sablot/include/sdom.h new file mode 100644 index 0000000..cee53ff --- /dev/null +++ b/win32/sablot/include/sdom.h @@ -0,0 +1,921 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Sablotron XSLT Processor. + * + * The Initial Developer of the Original Code is Ginger Alliance Ltd. + * Portions created by Ginger Alliance are Copyright (C) 2000-2002 + * Ginger Alliance Ltd. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + */ + +/* sdom.h */ + +#ifndef SDomHIncl +#define SDomHIncl + +//used for DISABLE_DOM only anything else is DANGEROUS +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifndef DISABLE_DOM + +#include "sablot.h" + +/** + ** + ** types + ** + **/ + +typedef void* SDOM_Node; +typedef void* SDOM_NodeList; +/* typedef void* SDOM_Document; */ + +typedef enum +{ + SDOM_ELEMENT_NODE = 1, + SDOM_ATTRIBUTE_NODE = 2, + SDOM_TEXT_NODE = 3, + SDOM_CDATA_SECTION_NODE = 4, + SDOM_ENTITY_REFERENCE_NODE = 5, + SDOM_ENTITY_NODE = 6, + SDOM_PROCESSING_INSTRUCTION_NODE = 7, + SDOM_COMMENT_NODE = 8, + SDOM_DOCUMENT_NODE = 9, + SDOM_DOCUMENT_TYPE_NODE = 10, + SDOM_DOCUMENT_FRAGMENT_NODE = 11, + SDOM_NOTATION_NODE = 12, + SDOM_OTHER_NODE /* not in spec */ +} +SDOM_NodeType; + +/* + * we define DOM_char as char, although the spec says strings should be + * UTF_16. Needs check. + */ +typedef char SDOM_char; + + +/* + * DomException + * will be an enum of all the values given in the spec. + */ + +/* + INDEX_SIZE_ERR, 1 + STRING_SIZE_ERR, 2 + HIERARCHY_REQUEST_ERR, 3 + WRONG_DOCUMENT_ERR, 4 + INVALID_CHARACTER_ERR, 5 + NO_DATA_ALLOWED_ERR, 6 + NO_MODIFICATION_ALLOWED_ERR, 7 + NOT_FOUND_ERR, 8 + NOT_SUPPORTED_ERR, 9 + INUSE_ATTRIBUTE_ERR, 10 + INVALID_STATE_ERR, 11 + SYNTAX_ERR, 12 + INVALID_MODIFICATION_ERR, 13 + NAMESPACE_ERR, 14 + INVALID_ACCESS_ERR, 15 +*/ + +typedef enum +{ + SDOM_OK, + SDOM_INDEX_SIZE_ERR = 1, + SDOM_DOMSTRING_SIZE_ERR = 2, + SDOM_HIERARCHY_REQUEST_ERR = 3, + SDOM_WRONG_DOCUMENT_ERR = 4, + SDOM_INVALID_CHARACTER_ERR = 5, + SDOM_NO_DATA_ALLOWED_ERR = 6, + SDOM_NO_MODIFICATION_ALLOWED_ERR = 7, + SDOM_NOT_FOUND_ERR = 8, + SDOM_NOT_SUPPORTED_ERR = 9, + SDOM_INUSE_ATTRIBUTE_ERR = 10, + SDOM_INVALID_STATE_ERR = 11, + SDOM_SYNTAX_ERR = 12, + SDOM_INVALID_MODIFICATION_ERR = 13, + SDOM_NAMESPACE_ERR = 14, + SDOM_INVALID_ACCESS_ERR = 15, + /* not in spec below this point: */ + SDOM_INVALID_NODE_TYPE, /* eg passing a non-element for an element */ + SDOM_QUERY_PARSE_ERR, + SDOM_QUERY_EXECUTION_ERR, + SDOM_NOT_OK +} SDOM_Exception; + +/** + ** + ** Node + ** n is always the node the function is to operate on (kind of 'this') + ** + **/ + +/* + createElement + Creates a new element Node with NULL parent and specified owner, + and returns it in *pn. + Raises: + */ +Declare( +SDOM_Exception SDOM_createElement( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *tagName); +) + +//_JP_ v +/* + createElementNS + Creates a new element Node with NULL parent and specified owner, + and returns it in *pn. + Raises: + SDOM_NAMESPACE_ERR or SDOM_INVALID_CHARACTER_ERR when qName or uri malformed + */ +Declare( +SDOM_Exception SDOM_createElementNS( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *uri, + const SDOM_char *qName); +) +//_JP_ ^ + +/* + createAttribute + Creates a new attribute Node and returns it in *pn. + Raises: + */ + +Declare +( +SDOM_Exception SDOM_createAttribute( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *name); +) + +//_JP_ v +/* + createAttributeNS + Creates a new attribute Node and returns it in *pn. + Raises: + SDOM_NAMESPACE_ERR or SDOM_INVALID_CHARACTER_ERR when qName or uri malformed + */ +Declare( +SDOM_Exception SDOM_createAttributeNS( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *uri, + const SDOM_char *qName); +) +//_JP_ ^ + + +/* + createTextNode + Raises: + */ + +Declare +( +SDOM_Exception SDOM_createTextNode( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *data); +) + +/* + createAttribute + Creates a new attribute Node and returns it in *pn. + Raises: + */ + +Declare +( +SDOM_Exception SDOM_createCDATASection( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *data); +) + +/* + createComment + Raises: + */ + +Declare +( +SDOM_Exception SDOM_createComment( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *data); +) + +/* + createProcessingInstruction + Raises: + */ + +Declare +( +SDOM_Exception SDOM_createProcessingInstruction( + SablotSituation s, + SDOM_Document d, + SDOM_Node *pn, + const SDOM_char *target, + const SDOM_char *data); +) + +/* + disposeNode + Frees all memory used by the node. + Raises: + !SPEC: Not in the spec. + */ + +Declare +( +SDOM_Exception SDOM_disposeNode( + SablotSituation s, + SDOM_Node n); +) + + +/* + getNodeType + Returns the node type in *pType. + Raises: + */ + +Declare +( +SDOM_Exception SDOM_getNodeType( + SablotSituation s, + SDOM_Node n, + SDOM_NodeType *pType); +) + + +/* + getNodeName + Returns the pointer to the name of the node in *pName. +*/ + +Declare +( +SDOM_Exception SDOM_getNodeName( + SablotSituation s, + SDOM_Node n, + SDOM_char **pName); +) + +Declare +( +SDOM_Exception SDOM_getNodeNSUri( + SablotSituation s, + SDOM_Node n, + SDOM_char **pName); +) + +Declare +( +SDOM_Exception SDOM_getNodePrefix( + SablotSituation s, + SDOM_Node n, + SDOM_char **pName); +) + +Declare +( +SDOM_Exception SDOM_getNodeLocalName( + SablotSituation s, + SDOM_Node n, + SDOM_char **pName); +) + +/* + setNodeName + Sets the node name. +*/ +Declare( +SDOM_Exception SDOM_setNodeName( + SablotSituation s, + SDOM_Node n, + const SDOM_char *name); +) + +/* + getNodeValue + Returns in *pValue the string value of the node. +*/ +Declare( +SDOM_Exception SDOM_getNodeValue( + SablotSituation s, + SDOM_Node n, + SDOM_char **pValue); +) + +/* + setNodeValue + Sets the node value. +*/ +Declare( +SDOM_Exception SDOM_setNodeValue( + SablotSituation s, + SDOM_Node n, + const SDOM_char *value); +) + +/* + getParentNode + Returns the parent in *pParent. +*/ +Declare( +SDOM_Exception SDOM_getParentNode( + SablotSituation s, + SDOM_Node n, + SDOM_Node *pParent); +) + +/* + getFirstChild + Returns the first child in *pFirstChild. +*/ +Declare( +SDOM_Exception SDOM_getFirstChild( + SablotSituation s, + SDOM_Node n, + SDOM_Node *pFirstChild); +) + +/* + getLastChild + Returns the last child in *pLastChild. +*/ +Declare( +SDOM_Exception SDOM_getLastChild( + SablotSituation s, + SDOM_Node n, + SDOM_Node *pLastChild); +) + +/* + getPreviousSibling + Returns the previous sibling in *pPreviousSibling. +*/ +Declare( +SDOM_Exception SDOM_getPreviousSibling( + SablotSituation s, + SDOM_Node n, + SDOM_Node *pPreviousSibling); +) + +/* + getNextSibling + Returns the next sibling in *pNextSibling. +*/ +Declare( +SDOM_Exception SDOM_getNextSibling( + SablotSituation s, + SDOM_Node n, + SDOM_Node *pNextSibling); +) + +/* + getChildNode + Returns the child node in specified index or NULL. +*/ +Declare( +SDOM_Exception SDOM_getChildNodeIndex( + SablotSituation s, + SDOM_Node n, + int index, + SDOM_Node *pChildNode); +) + +/* + getChildNodeCount + Returns the count of child nodes. +*/ +Declare( +SDOM_Exception SDOM_getChildNodeCount( + SablotSituation s, + SDOM_Node n, + int *count); +) + +/* + getOwnerDocument + Returns, in *pOwnerDocument, the Document owning the node. + !SPEC: If the node is standalone, returns NULL. +*/ +Declare( +SDOM_Exception SDOM_getOwnerDocument( + SablotSituation s, + SDOM_Node n, + SDOM_Document *pOwnerDocument); +) + +/* + insertBefore + Inserts newChild as n's child, just before refChild. +*/ +Declare( +SDOM_Exception SDOM_insertBefore( + SablotSituation s, + SDOM_Node n, + SDOM_Node newChild, + SDOM_Node refChild); +) + +/* + removeChild + Removes oldChild (a child of n) without deallocating it. +*/ + +Declare( +SDOM_Exception SDOM_removeChild( + SablotSituation s, + SDOM_Node n, + SDOM_Node oldChild); +) + +/* + replaceChild + Replaces oldChild (a child of n) by newChild. +*/ +Declare( +SDOM_Exception SDOM_replaceChild( + SablotSituation s, + SDOM_Node n, + SDOM_Node newChild, + SDOM_Node oldChild); +) + +/* + appendChild + Appends newChild as the last of n's children. +*/ +Declare( +SDOM_Exception SDOM_appendChild( + SablotSituation s, + SDOM_Node n, + SDOM_Node newChild); +) + +/* + cloneNode + Duplicates the node, returning the result in *clone. + If deep is nonzero, the cloning process will be recursive. +*/ + +Declare( +SDOM_Exception SDOM_cloneNode( + SablotSituation s, + SDOM_Node n, + int deep, + SDOM_Node *clone); +) + +/* + cloneForeignNode + Duplicates a node from a different doc, returning the result in *clone. + If deep is nonzero, the cloning process will be recursive. + As opposed to cloneNode, represents a Document method +*/ + +Declare( +SDOM_Exception SDOM_cloneForeignNode( + SablotSituation s, + SDOM_Document d, + SDOM_Node n, + int deep, + SDOM_Node *clone); +) + +/* + getAttribute + Returns, in *pValue, the contents of the attribute (of n) named 'name'. +*/ +Declare( +SDOM_Exception SDOM_getAttribute( + SablotSituation s, + SDOM_Node n, + const SDOM_char *name, + SDOM_char **pValue); +) + +/* + getAttributeNS + Returns, in *pValue, the contents of the attribute (of n) with 'uri' and 'local'. +*/ +Declare( +SDOM_Exception SDOM_getAttributeNS( + SablotSituation s, + SDOM_Node n, + SDOM_char *uri, + SDOM_char *local, + SDOM_char **pValue); +) + +/* + getAttributeNode + Returns, in *attr, the attribute named 'name'. +*/ +Declare( +SDOM_Exception SDOM_getAttributeNode( + SablotSituation s, + SDOM_Node n, + const SDOM_char *name, + SDOM_Node *attr); +) + +/* + getAttributeNodeNS + Returns, in *attr, the n's attribute with uri and local. +*/ +Declare( +SDOM_Exception SDOM_getAttributeNodeNS( + SablotSituation s, + SDOM_Node n, + SDOM_char *uri, + SDOM_char *local, + SDOM_Node *attr); +) + +//_JP_ v +/* + getAttributeNodeIndex + Returns, in *attr, the index'th attribute, namespaces precede other atts. +*/ +Declare( +SDOM_Exception SDOM_getAttributeNodeIndex( + SablotSituation s, + SDOM_Node n, + const int index, + SDOM_Node *attr); +) + +/* + getAttributeNodeCount + Returns, in *count, the count of atts, including namespaces in scope. +*/ +Declare( +SDOM_Exception SDOM_getAttributeNodeCount( + SablotSituation s, + SDOM_Node n, + int *count); +) +//_JP_ ^ + +/* + setAttribute + Assigns the given value to n's attribute named 'name'. +*/ +Declare( +SDOM_Exception SDOM_setAttribute( + SablotSituation s, + SDOM_Node n, + const SDOM_char *name, + const SDOM_char *value); +) + +/* + setAttributeNS + Assigns the given value to n's attribute with 'uri' and qualified name 'qName'. +*/ +Declare( +SDOM_Exception SDOM_setAttributeNS( + SablotSituation s, + SDOM_Node n, + const SDOM_char *uri, + const SDOM_char *qName, + const SDOM_char *value); +) + +/* + setAttributeNode + Assigns the given attnode as n's attribute. + Returns replaced, if was replaced some node with the same nodeName. +*/ +Declare( +SDOM_Exception SDOM_setAttributeNode( + SablotSituation s, + SDOM_Node n, + SDOM_Node attnode, + SDOM_Node *replaced); +) + +/* + setAttributeNodeNS + Assigns the given attnode to n's attribute with attnode.uri and attnode.localname. + Returns replaced, if was replaced some node. +*/ +Declare( +SDOM_Exception SDOM_setAttributeNodeNS( + SablotSituation s, + SDOM_Node n, + SDOM_Node attnode, + SDOM_Node *replaced); +) + +/* + removeAttribute + Removes the given attribute of n. +*/ +Declare( +SDOM_Exception SDOM_removeAttribute( + SablotSituation s, + SDOM_Node n, + const SDOM_char *name); +) + +/* + removeAttribute + Removes the given attribute of n. +*/ +Declare( +SDOM_Exception SDOM_removeAttributeNode( + SablotSituation s, + SDOM_Node n, + SDOM_Node attnode, + SDOM_Node *removed); +) +/* + attributeElement + returns owner element of attribute specified +*/ +Declare( +SDOM_Exception SDOM_getAttributeElement( + SablotSituation s, + SDOM_Node attr, + SDOM_Node *owner); +) + +/* + getAttributeList + Returns, in *pAttrList, the list of all attributes of the element n. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_getAttributeList( + SablotSituation s, + SDOM_Node n, + SDOM_NodeList *pAttrList); +) + +/** + ** END Node + **/ + + +/** + ** Functions related to Document + **/ + + +/* + docToString + Serializes the document, returning the resulting string in + *pSerialized, which is a Sablotron-allocated buffer. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_docToString( + SablotSituation s, + SDOM_Document d, + SDOM_char **pSerialized); +) + +Declare( +SDOM_Exception SDOM_nodeToString( + SablotSituation s, + SDOM_Document d, + SDOM_Node n, + SDOM_char **pSerialized); +) + +/** + ** END Document functions + **/ + + +/** + ** NodeList + ** An ordered collection of nodes, returned by xql. + **/ + + +/* + getNodeListLength + Returns, in *pLength, the number of nodes in the list l. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_getNodeListLength( + SablotSituation s, + SDOM_NodeList l, + int *pLength); +) + +/* + getNodeListItem + Returns, in *pItem, the index'th member of the node list l. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_getNodeListItem( + SablotSituation s, + SDOM_NodeList l, + int index, + SDOM_Node *pItem); +) + +/* + disposeNodeList + Destroys the node list l. The nodes themselves are NOT disposed. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_disposeNodeList( + SablotSituation s, + SDOM_NodeList l); +) + +/** + ** END NodeList + **/ + + +/** + ** Miscellaneous + **/ + +/* + xql + Returns, in *pResult, the list of all nodes satisfying the XPath + query given as a string in 'query'. For the evaluation of the query, the + current node will be set to currentNode. + Note that the query is necessarily rather restricted. + After the contents of *pResult have been retrieved, the list should + be freed using disposeNodeList. + !SPEC: Not in spec. +*/ +Declare( +SDOM_Exception SDOM_xql( + SablotSituation s, + const SDOM_char *query, + SDOM_Node currentNode, + SDOM_NodeList *pResult); +) + +/** + ** END Miscellaneous + ** + ** + ** + ** Exception retrieval + **/ + +/* + getExceptionCode + returns the code of the pending exception +*/ + +Declare +( + int SDOM_getExceptionCode(SablotSituation s); +) + +/* + getExceptionMessage + returns the message for the pending exception +*/ + +Declare +( + char* SDOM_getExceptionMessage(SablotSituation s); +) + +/* + getExceptionDetails + returns extra information for the pending exception + - on the code and message of the primary error + - on the document and file line where the primary error occured +*/ + +Declare +( + void SDOM_getExceptionDetails( + SablotSituation s, + int *code, + char **message, + char **documentURI, + int *fileLine); +) + +/** + ** END Exception retrieval + ** + ** + ** Internal functions + **/ + +/* + setNodeInstanceData + saves a pointer in a node instance +*/ + +Declare( +void SDOM_setNodeInstanceData(SDOM_Node n, void *data); +) + +/* + getNodeInstanceData + retrieves the saved pointer +*/ +Declare( +void* SDOM_getNodeInstanceData(SDOM_Node n); +) +/* + setDisposeNodeCallback + sets callback to be called on every node disposal +*/ + +typedef void SDOM_NodeCallback(SDOM_Node n); + +Declare +( + void SDOM_setDisposeCallback(SDOM_NodeCallback *f); +) + +Declare +( + SDOM_NodeCallback* SDOM_getDisposeCallback(); +) + +/** + ** FOR IMPLEMENTATION IN PERL + ** None of these fuctions appear in the spec. + **/ + + +/* + ArrayRef getChildNodes(Node n) + Returns the array of n's children. + Implement using getFirstChild and getNextSibling. + + + HashRef getAttributes(Node n) + Returns the hash of n's attributes. + Implement using getAttributeList, getNodeListLength, + getNodeListItem, getNodeName and getNodeValue. + + + setAttributes(Node n, HashRef atts) + Sets n's attributes to atts, keeping the old ones alive but making + them standalone. + Implement using getAttributeList, getNodeListLength, removeAttribute + and setAttribute (not too efficient perhaps). +*/ + + /* _TH_ v */ +Declare +( + void SDOM_tmpListDump(SDOM_Document doc, int p); +) + +#endif /* DISABLE_DOM */ + +#endif /* SDomHIncl */ diff --git a/win32/sablot/include/shandler.h b/win32/sablot/include/shandler.h new file mode 100644 index 0000000..ea7fc83 --- /dev/null +++ b/win32/sablot/include/shandler.h @@ -0,0 +1,369 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Sablotron XSLT Processor. + * + * The Initial Developer of the Original Code is Ginger Alliance Ltd. + * Portions created by Ginger Alliance are Copyright (C) 2000-2002 + * Ginger Alliance Ltd. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + */ + +#ifndef ShandlerHIncl +#define ShandlerHIncl + +/* we have to deal with the size_t type, sys/types.h; + is needed on some platforms */ +#if !defined(_MSC_VER) +#include +#endif + +#include + +/* GP: clean */ + +/***************************************************************** + + handler types + +*****************************************************************/ + +typedef enum +{ + HLR_MESSAGE = 0, + HLR_SCHEME, + HLR_SAX, + HLR_MISC, + HLR_ENC +} HandlerType; + +extern const char* hlrTypeNames[]; /* found in base.cpp */ + +typedef enum +{ + SH_ERR_OK = 0, + SH_ERR_NOT_OK = 1, + SH_ERR_UNSUPPORTED_SCHEME +} SchemeHandlerErrors; + +/***************************************************************** +SchemeHandler + + is a structure for a scheme handler. It contains pointers to + the following functions of the handler: + open(), get(), put(), close(). + All of these function return an error flag (0=OK, 1=not). + open() may also return SH_ERR_UNSUPPORTED_SCHEME. +*****************************************************************/ + +/* getAll: open the URI and return the whole string + scheme = URI scheme (e.g. "http") + rest = the rest of the URI (without colon) + the document is returned in a handler-allocated buffer + byteCount holds the byte count on return + return *buffer = NULL if not processed +*/ +typedef int SchemeHandlerGetAll(void *userData, SablotHandle processor_, + const char *scheme, const char *rest, + char **buffer, int *byteCount); + +/* freeMemory: free the buffer allocated by getAll +*/ + +typedef int SchemeHandlerFreeMemory(void *userData, SablotHandle processor_, + char *buffer); + +/* open: open the URI and return a handle + scheme = URI scheme (e.g. "http") + rest = the rest of the URI (without colon) + the resulting handle is returned in '*handle' +*/ +typedef int SchemeHandlerOpen(void *userData, SablotHandle processor_, + const char *scheme, const char *rest, int *handle); + +/* get: retrieve data from the URI + handle = the handle assigned on open + buffer = pointer to the data + *byteCount = number of bytes to read + (the number actually read is returned here) +*/ +typedef int SchemeHandlerGet(void *userData, SablotHandle processor_, + int handle, char *buffer, int *byteCount); + +/* put: save data to the URI (if possible) + handle = the handle assigned on open + buffer = pointer to the data + *byteCount = number of bytes to write + (the number actually written is returned here) +*/ +typedef int SchemeHandlerPut(void *userData, SablotHandle processor_, + int handle, const char *buffer, int *byteCount); + +/* close: close the URI with the given handle + handle = the handle assigned on open +*/ +typedef int SchemeHandlerClose(void *userData, SablotHandle processor_, + int handle); + +typedef struct +{ + SchemeHandlerGetAll *getAll; + SchemeHandlerFreeMemory *freeMemory; + SchemeHandlerOpen *open; + SchemeHandlerGet *get; + SchemeHandlerPut *put; + SchemeHandlerClose *close; +} SchemeHandler; + +/***************************************************************** +MessageHandler + + a structure for external message handlers. Such a handler, if set, + receives all error reports, displays them, keeps the log, the + error trace, etc. +*****************************************************************/ + +/* + define the "facility number" for Sablotron. This does not mean much + nowadays. +*/ + +#define MH_FACILITY_SABLOTRON 2 + +/* type for the error codes used by the message handler */ + +typedef unsigned long MH_ERROR; + +/* logging levels for the message handler */ + +typedef enum +{ + MH_LEVEL_DEBUG, + MH_LEVEL_INFO, + MH_LEVEL_WARN, + MH_LEVEL_ERROR, + MH_LEVEL_CRITICAL +} MH_LEVEL; + +/* + makeCode() + makes the "external" error code to report with log() or error() + call with facility = module id; severity = 1 iff critical. + 'code' is the error code internal to Sablotron. +*/ + +typedef MH_ERROR +MessageHandlerMakeCode( + void *userData, SablotHandle processor_, + int severity, unsigned short facility, unsigned short code); + +/* + log() + pass code created by makeCode, level as necessary + fields is a NULL-terminated list of strings in form "field:contents" + distinguished fields include: msg, file, line, token +*/ + +typedef MH_ERROR +MessageHandlerLog( + void *userData, SablotHandle processor_, + MH_ERROR code, MH_LEVEL level, char **fields); + +/* + error() + for reporting errors, meaning as with log() +*/ + +typedef MH_ERROR +MessageHandlerError(void *userData, SablotHandle processor_, + MH_ERROR code, MH_LEVEL level, char **fields); + +/* the message handler structure. Use SablotRegMessageHandler() to register. */ + +typedef struct +{ + MessageHandlerMakeCode *makeCode; + MessageHandlerLog *log; + MessageHandlerError *error; +} MessageHandler; + + + + + +/* + + SAXHandler + a SAX-like, streaming interface for access to XML docs + +*/ + + +#define SAX_RETURN void + +typedef SAX_RETURN +SAXHandlerStartDocument(void* userData, SablotHandle processor_); + +typedef SAX_RETURN +SAXHandlerStartElement(void* userData, SablotHandle processor_, + const char* name, const char** atts); + +typedef SAX_RETURN +SAXHandlerEndElement(void* userData, SablotHandle processor_, + const char* name); + +typedef SAX_RETURN +SAXHandlerStartNamespace(void* userData, SablotHandle processor_, + const char* prefix, const char* uri); + +typedef SAX_RETURN +SAXHandlerEndNamespace(void* userData, SablotHandle processor_, + const char* prefix); + +typedef SAX_RETURN +SAXHandlerComment(void* userData, SablotHandle processor_, + const char* contents); + +typedef SAX_RETURN +SAXHandlerPI(void* userData, SablotHandle processor_, + const char* target, const char* contents); + +typedef SAX_RETURN +SAXHandlerCharacters(void* userData, SablotHandle processor_, + const char* contents, int length); + +typedef SAX_RETURN +SAXHandlerEndDocument(void* userData, SablotHandle processor_); + + +/* + The SAX handler structure. Use SablotRegSAXHandler() to register. +*/ + + +typedef struct +{ + SAXHandlerStartDocument *startDocument; + SAXHandlerStartElement *startElement; + SAXHandlerEndElement *endElement; + SAXHandlerStartNamespace *startNamespace; + SAXHandlerEndNamespace *endNamespace; + SAXHandlerComment *comment; + SAXHandlerPI *processingInstruction; + SAXHandlerCharacters *characters; + SAXHandlerEndDocument *endDocument; +} SAXHandler; + + +/***************************************************************** +MiscHandler + + Collects miscellaneous callbacks. +*****************************************************************/ + +/* + documentInfo() + If set, this callback gets called after the output of a result + document is finished, giving information about its content type + and encoding. +*/ + +typedef void +MiscHandlerDocumentInfo(void* userData, SablotHandle processor_, + const char *contentType, const char *encoding); + +/* + The Misc handler structure. + Use SablotRegHandler(HLR_MISC, ...) to register. +*/ + +typedef struct +{ + MiscHandlerDocumentInfo *documentInfo; +} MiscHandler; + +/***************************************************************** +EncHandler + + Handler for recoding requests in absence of iconv. +*****************************************************************/ + +#define EH_FROM_UTF8 1 +#define EH_TO_UTF8 0 + +/* + the conversion descriptor like iconv_t +*/ + +typedef void* EHDescriptor; + +typedef enum +{ + EH_OK, + EH_EINVAL, + EH_E2BIG, + EH_EILSEQ +} EHResult; + +/* + open() + direction is either EH_FROM_UTF8 or EH_TO_UTF8 + encoding is the other encoding + RETURN the descriptor, or -1 if the encoding is not supported +*/ + +typedef EHDescriptor EncHandlerOpen(void* userData, SablotHandle processor_, + int direction, const char *encoding); + +/* + conv() + arguments 3 through 7 are just like for iconv, see the manpage + RETURN -1 on error (set errno), a different value (e.g. 0) if OK +*/ + +typedef EHResult EncHandlerConv(void* userData, SablotHandle processor_, + EHDescriptor cd, const char** inbuf, size_t *inbytesleft, + char ** outbuf, size_t *outbytesleft); + +/* + close() + cd is the descriptor to close. Return 0 if OK, -1 on error. +*/ + +typedef int EncHandlerClose(void* userData, SablotHandle processor_, + EHDescriptor cd); + +/* + The EncHandler structure. + Use SablotRegHandler(HLR_ENC, ...) to register. +*/ + +typedef struct +{ + EncHandlerOpen *open; + EncHandlerConv *conv; + EncHandlerClose *close; +} EncHandler; + +#endif diff --git a/win32/sablot/include/sxpath.h b/win32/sablot/include/sxpath.h new file mode 100644 index 0000000..d6bd448 --- /dev/null +++ b/win32/sablot/include/sxpath.h @@ -0,0 +1,264 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Sablotron XSLT Processor. + * + * The Initial Developer of the Original Code is Ginger Alliance Ltd. + * Portions created by Ginger Alliance are Copyright (C) 2000-2002 + * Ginger Alliance Ltd. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + */ + +#ifndef SXPathHIncl +#define SXPathHIncl + +/* basic types needed in sablot.h */ +typedef void *SXP_Node; +typedef void *SXP_Document; +typedef void *SXP_NodeList; +typedef SXP_Node NodeHandle; + +#include "sablot.h" + +typedef enum +{ + ELEMENT_NODE = 1, + ATTRIBUTE_NODE = 2, + TEXT_NODE = 3, + PROCESSING_INSTRUCTION_NODE = 7, + COMMENT_NODE = 8, + DOCUMENT_NODE = 9, + NAMESPACE_NODE = 13 +} SXP_NodeType; + +typedef enum +{ + SXP_NONE, + SXP_NUMBER, + SXP_STRING, + SXP_BOOLEAN, + SXP_NODESET +} SXP_ExpressionType; + +typedef char SXP_char; + +typedef void *QueryContext; + +/*option constants */ +typedef enum +{ + SXPF_DISPOSE_NAMES = 0x1, + SXPF_DISPOSE_VALUES = 0x2, + SXPF_SUPPORTS_UNPARSED_ENTITIES =0x4 +} SXPFlags; + +/* + * DOM handler functions + * This handler is registered with the Situation rather than the Processor + */ + +/***************************************************************** +DOMHandler + + Handler providing information about a DOM tree to the XPath + processor +*****************************************************************/ + +typedef SXP_NodeType DOMH_getNodeType(SXP_Node n); +typedef const SXP_char* DOMH_getNodeName(SXP_Node n); +typedef const SXP_char* DOMH_getNodeNameURI(SXP_Node n); +typedef const SXP_char* DOMH_getNodeNameLocal(SXP_Node n); +typedef const SXP_char* DOMH_getNodeValue(SXP_Node n); +typedef SXP_Node DOMH_getNextSibling(SXP_Node n); +typedef SXP_Node DOMH_getPreviousSibling(SXP_Node n); +typedef SXP_Node DOMH_getNextAttrNS(SXP_Node n); +typedef SXP_Node DOMH_getPreviousAttrNS(SXP_Node n); +typedef int DOMH_getChildCount(SXP_Node n); +typedef int DOMH_getAttributeCount(SXP_Node n); +typedef int DOMH_getNamespaceCount(SXP_Node n); +typedef SXP_Node DOMH_getChildNo(SXP_Node n, int ndx); +typedef SXP_Node DOMH_getAttributeNo(SXP_Node n, int ndx); +typedef SXP_Node DOMH_getNamespaceNo(SXP_Node n, int ndx); +typedef SXP_Node DOMH_getParent(SXP_Node n); +typedef SXP_Document DOMH_getOwnerDocument(SXP_Node n); +typedef int DOMH_compareNodes(SXP_Node n1, SXP_Node n2); +typedef SXP_Document DOMH_retrieveDocument(const SXP_char* uri, + void* udata); +typedef SXP_Node DOMH_getNodeWithID(SXP_Document doc, const SXP_char* id); +typedef void DOMH_freeBuffer(SXP_char *buff); + +typedef struct +{ + DOMH_getNodeType *getNodeType; + DOMH_getNodeName *getNodeName; + DOMH_getNodeNameURI *getNodeNameURI; + DOMH_getNodeNameLocal *getNodeNameLocal; + DOMH_getNodeValue *getNodeValue; + DOMH_getNextSibling *getNextSibling; + DOMH_getPreviousSibling *getPreviousSibling; + DOMH_getNextAttrNS *getNextAttrNS; + DOMH_getPreviousAttrNS *getPreviousAttrNS; + DOMH_getChildCount *getChildCount; + DOMH_getAttributeCount *getAttributeCount; + DOMH_getNamespaceCount *getNamespaceCount; + DOMH_getChildNo *getChildNo; + DOMH_getAttributeNo *getAttributeNo; + DOMH_getNamespaceNo *getNamespaceNo; + DOMH_getParent *getParent; + DOMH_getOwnerDocument *getOwnerDocument; + DOMH_compareNodes *compareNodes; + DOMH_retrieveDocument *retrieveDocument; + DOMH_getNodeWithID *getNodeWithID; + /*optional entries - driven by sxpOptions */ + DOMH_freeBuffer *freeBuffer; +} DOMHandler; + +Declare +( + void SXP_registerDOMHandler(SablotSituation S, + DOMHandler *domh, void* udata); +) + +Declare +( + void SXP_unregisterDOMHandler(SablotSituation S); +) + +/* + * + * QueryContext functions + * + */ + +/* options setter getter */ +Declare +( + void SXP_setOptions(SablotSituation S, unsigned long options); +) + +Declare +( + void SXP_setMaskBit(SablotSituation S, int mask); +) + +Declare +( + unsigned long SXP_getOptions(SablotSituation S); +) + +Declare +( + int SXP_createQueryContext(SablotSituation S, QueryContext *Q); +) + +Declare +( + int SXP_addVariableBinding(QueryContext Q, + const SXP_char* name, QueryContext source); +) + +Declare +( + int SXP_addVariableNumber(QueryContext Q, + const SXP_char* name, double value); +) + +Declare +( + int SXP_addVariableString(QueryContext Q, + const SXP_char* name, const SXP_char* value); +) + +Declare +( + int SXP_addVariableBoolean(QueryContext Q, + const SXP_char* name, int value); +) + +Declare +( + int SXP_addNamespaceDeclaration(QueryContext Q, + const SXP_char* prefix, const SXP_char* uri); +) + +Declare +( + int SXP_query(QueryContext Q, const SXP_char* query, + SXP_Node n, int contextPosition, int contextSize); +) + +Declare +( + int SXP_destroyQueryContext(QueryContext Q); +) + +/* + * + * Functions to retrieve the query result and its type + * + */ + +Declare +( + int SXP_getResultType(QueryContext Q, SXP_ExpressionType *type); +) + +Declare +( + int SXP_getResultNumber(QueryContext Q, double *result); +) + +Declare +( + int SXP_getResultBool(QueryContext Q, int *result); +) + +Declare +( + int SXP_getResultString(QueryContext Q, const char **result); +) + +Declare +( + int SXP_getResultNodeset(QueryContext Q, SXP_NodeList *result); +) + +/* + * + * NodeList manipulation + * + */ + +Declare +( + int SXP_getNodeListLength(SXP_NodeList l); +) + +Declare +( + SXP_Node SXP_getNodeListItem(QueryContext Q, SXP_NodeList l, int index); +) + + +#endif /* SXPathHIncl */ -- cgit v1.2.3