//
//
//	XMLLibStub.h
//	
//	Copyright © 2003 Nemetschek North America 
//	All Rights Reserved.
//
//	This file contains stub functions for the "XMLLib" SDK Plug-in Library.
//	These stub functions do necessary allocation of argument tables and overhead of calling into the SDK Plug-in Library.
//	These prototypes enable other SDK Plug-ins to conveniently use the XMLLib
//	features without worrying about the details of calling mechanism.  
//

#if _WINDOWS
#include <Windows.h>
#include "GSWinSDK.h"	// Graphsoft Required.
#else
#include "StdHeaders.h"
#endif

#include <MiniCadCallBacks.h>
#include <MiniCadExternals.h>

#include <GSString.h>
#include <GSString.X.h>


// Error codes returned from XMLLib functions
// (These are defined in XMLLib.h for the XMLLib plug-in library.)
const short kXMLNoError 				= 0;
const short kXMLUnknownError 			= -1;
const short kXMLInvalidPathError		= -2;
const short kXMLElementNotFoundError	= -3;
const short kXMLAttributeNotFoundError	= -4;
const short kXMLCDATASectionNotFoundError	= -5;
const short kXMLMemoryError					= -20;
const short	kXMLInvalidXMLHandleError		= -21;
const short	kXMLInvalidParametersError		= -22;
const short kXMLParserError					= -23;	// From Xerces
const short kXMLNoChildOrSiblingNodes		= -24;	// Node has no children, or succeeding or preceding sibling
// errors -30 - -60 are reserved for DOM errors
// errors -1000 - -2000 are reserved for XML errors


/* This is the original API that shipped with VW10.5b(18991)SDK.
long InitXML();
void CreateNewXMLDocument(long XMLHandle, Str255 rootElementName);
short ReadXMLFile(long XMLHandle, short whichPath, Str255 filename);
short WriteXMLFile(long XMLHandle, short whichPath, Str255 filename);
Boolean GetElementValue(long XMLHandle, Str255 elementPath, Str255& value);
void SetElementValue(long XMLHandle, Str255 elementPath, Str255 value);
void DeleteElement(long XMLHandle, Str255 elementPath);
Boolean GetAttributeValue(long XMLHandle, Str255 elementPath, Str255 attribute, Str255& value);
void SetAttributeValue(long XMLHandle, Str255 elementPath, Str255 attribute, Str255 value);
void DeleteAttribute(long XMLHandle, Str255 elementPath, Str255 attribute);
GSHandle GetCDATA(long XMLHandle, Str255 elementPath);
void SetCDATA(long XMLHandle, Str255 elementPath, void* data);
void DeleteCDATA(long XMLHandle, Str255 elementPath);
void ReleaseXML(long XMLHandle);
*/

// This is the latest API after improving the error handling. 
long InitXML();
short CreateNewXMLDocument(long XMLHandle, Str255 rootElementName);
short ReadXMLFile(long XMLHandle, short whichPath, ConstStr255Param filename);
short WriteXMLFile(long XMLHandle, short whichPath, ConstStr255Param filename);
short GetElementValue(long XMLHandle, Str255 elementPath, Str255& value);
short SetElementValue(long XMLHandle, Str255 elementPath, Str255 value);
short DeleteElement(long XMLHandle, Str255 elementPath);
short GetAttributeValue(long XMLHandle, Str255 elementPath, Str255 attribute, Str255& value);
short SetAttributeValue(long XMLHandle, Str255 elementPath, Str255 attribute, Str255 value);
short DeleteAttribute(long XMLHandle, Str255 elementPath, Str255 attribute);
short GetCDATA(long XMLHandle, Str255 elementPath, GSHandle& returnVal);
short SetCDATA(long XMLHandle, Str255 elementPath, void* data);
short DeleteCDATA(long XMLHandle, Str255 elementPath);
short ReleaseXML(long XMLHandle);
short ReadXMLMemory(long XMLHandle, void* data);
short WriteXMLMemory(long XMLHandle, char*& data);	// XMLLib allocate buffer, fills it, null-terminates it.
// GetFirstChild
// GetNextElement
// GetPreviousElement
// FindElement
// FindAttribute

