📄 sfxxmldatalib.pas
字号:
unit SfxXMLDataLib;
{$TYPEDADDRESS OFF}
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface
uses Windows, ActiveX, Classes, Graphics, OleCtrls, AxCtrls, ComObj;
const
// TypeLibrary Major and minor versions
SfxXMLDataLibMajorVersion = 1;
SfxXMLDataLibMinorVersion = 0;
CLASS_ServerXMLData: TGUID = '{9B6D6F4C-1F1A-48C2-8888-60B93002A445}';
CLASS_ClientXMLData: TGUID = '{02836DBD-9F4A-4BA0-9E9B-E209B1AB2D19}';
type BagMode = Integer;
const
BAGMODE_PLAIN = 1;
BAGMODE_NESTED = 2;
BAGMODE_AUTODETECT = 32;
BAGMODE_ADOXML = 4352;
BAGMODE_NETXML = 4608;
type
IXMLData = interface;
//*********************************************************************//
// Class: IXMLData
//*********************************************************************//
IXMLData = interface(IDispatch)
['{B82692FE-27EC-4B63-A908-4A42D4A4DE00}']
function get_BagTagName: WideString; safecall;
procedure set_BagTagName(const pVal: WideString); safecall;
function get_BagAttrName: WideString; safecall;
procedure set_BagAttrName(const pVal: WideString); safecall;
function get_BagMode: BagMode; safecall;
procedure set_BagMode(pVal: BagMode); safecall;
procedure LoadURL(const bstr: WideString); safecall;
function get_BagAttrValue: WideString; safecall;
procedure set_BagAttrValue(const pVal: WideString); safecall;
function get_BagTagObject: WideString; safecall;
procedure set_BagTagObject(const pVal: WideString); safecall;
function get_ErrorCode: Integer; safecall;
function get_ErrorText: WideString; safecall;
procedure LoadFromString(const bstr: WideString); safecall;
end;
//*********************************************************************//
// Class: IXMLData
//*********************************************************************//
XMLData = class
private
DefaultInterface : IXMLData;
protected
// Properties
function Get_ErrorText: WideString;
function Get_ErrorCode: Integer;
function Get_BagTagObject: WideString;
procedure Set_BagTagObject(const val: WideString);
function Get_BagAttrValue: WideString;
procedure Set_BagAttrValue(const val: WideString);
function Get_BagMode: BagMode;
procedure Set_BagMode(val: BagMode);
function Get_BagAttrName: WideString;
procedure Set_BagAttrName(const val: WideString);
function Get_BagTagName: WideString;
procedure Set_BagTagName(const val: WideString);
public
// Methods
procedure LoadURL(const bstr: WideString);
procedure LoadFromString(const bstr: WideString);
property ErrorText: WideString read Get_ErrorText;
property ErrorCode: Integer read Get_ErrorCode;
property BagTagObject: WideString read Get_BagTagObject write Set_BagTagObject;
property BagAttrValue: WideString read Get_BagAttrValue write Set_BagAttrValue;
property BagMode: BagMode read Get_BagMode write Set_BagMode;
property BagAttrName: WideString read Get_BagAttrName write Set_BagAttrName;
property BagTagName: WideString read Get_BagTagName write Set_BagTagName;
property InterfacePtr : IXMLData read DefaultInterface;
end;
//*********************************************************************//
// Class: ServerXMLData
//*********************************************************************//
ServerXMLData = class(XMLData)
public
constructor Create;
end;
//*********************************************************************//
// Class: ClientXMLData
//*********************************************************************//
ClientXMLData = class(XMLData)
public
constructor Create;
end;
implementation
function XMLData.Get_ErrorText(): WideString;
begin
Result := DefaultInterface.Get_ErrorText();
end;
function XMLData.Get_ErrorCode(): Integer;
begin
Result := DefaultInterface.Get_ErrorCode();
end;
function XMLData.Get_BagTagObject(): WideString;
begin
Result := DefaultInterface.Get_BagTagObject();
end;
procedure XMLData.Set_BagTagObject(const val: WideString);
begin
DefaultInterface.Set_BagTagObject(val);
end;
function XMLData.Get_BagAttrValue(): WideString;
begin
Result := DefaultInterface.Get_BagAttrValue();
end;
procedure XMLData.Set_BagAttrValue(const val: WideString);
begin
DefaultInterface.Set_BagAttrValue(val);
end;
function XMLData.Get_BagMode(): BagMode;
begin
Result := DefaultInterface.Get_BagMode();
end;
procedure XMLData.Set_BagMode(val: BagMode);
begin
DefaultInterface.Set_BagMode(val);
end;
function XMLData.Get_BagAttrName(): WideString;
begin
Result := DefaultInterface.Get_BagAttrName();
end;
procedure XMLData.Set_BagAttrName(const val: WideString);
begin
DefaultInterface.Set_BagAttrName(val);
end;
function XMLData.Get_BagTagName(): WideString;
begin
Result := DefaultInterface.Get_BagTagName();
end;
procedure XMLData.Set_BagTagName(const val: WideString);
begin
DefaultInterface.Set_BagTagName(val);
end;
procedure XMLData.LoadURL(const bstr: WideString);
begin
DefaultInterface.LoadURL(bstr);
end;
procedure XMLData.LoadFromString(const bstr: WideString);
begin
DefaultInterface.LoadFromString(bstr);
end;
constructor ServerXMLData.Create;
begin
DefaultInterface := CreateComObject(CLASS_ServerXMLData) as IXMLData;
end;
constructor ClientXMLData.Create;
begin
DefaultInterface := CreateComObject(CLASS_ClientXMLData) as IXMLData;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -