{***************************************************************************************************************************}
{ }
{ XML Data Binding }
{ }
{ Generated on: 02.07.2006 13:38:46 }
{ Generated from: C:\Programme\Microsoft.NET\SDK\v1.1\QuickStart\howto\samples\xml\datasetmapxsdschema\cp\books.xsd }
{ Settings stored in: C:\Programme\Microsoft.NET\SDK\v1.1\QuickStart\howto\samples\xml\datasetmapxsdschema\cp\books.xdb }
{ }
{***************************************************************************************************************************}
unit books;
interface
uses xmldom, XMLDoc, XMLIntf;
type
{ Forward Decls }
IXMLBookstoreType =
interface;
IXMLBookType =
interface;
IXMLAuthorName =
interface;
{ IXMLBookstoreType }
IXMLBookstoreType =
interface(IXMLNodeCollection)
['
{0A282638-866F-433A-8D0D-56779ED9C48A}']
{ Property Accessors }
function Get_Book(
Index: Integer): IXMLBookType;
{ Methods & Properties }
function Add: IXMLBookType;
function Insert(
const Index: Integer): IXMLBookType;
property Book[
Index: Integer]: IXMLBookType
read Get_Book;
default;
end;
{ IXMLBookType }
IXMLBookType =
interface(IXMLNode)
['
{7F1161D5-382F-49BF-88B7-CEEFC5931A50}']
{ Property Accessors }
function Get_Genre: WideString;
function Get_Title: WideString;
function Get_Author: IXMLAuthorName;
function Get_Price: WideString;
procedure Set_Genre(Value: WideString);
procedure Set_Title(Value: WideString);
procedure Set_Price(Value: WideString);
{ Methods & Properties }
property Genre: WideString
read Get_Genre
write Set_Genre;
property Title: WideString
read Get_Title
write Set_Title;
property Author: IXMLAuthorName
read Get_Author;
property Price: WideString
read Get_Price
write Set_Price;
end;
{ IXMLAuthorName }
IXMLAuthorName =
interface(IXMLNode)
['
{174B60BC-E05A-47E3-8AE9-C1ADBA99D409}']
{ Property Accessors }
function Get_Firstname: WideString;
function Get_Lastname: WideString;
procedure Set_Firstname(Value: WideString);
procedure Set_Lastname(Value: WideString);
{ Methods & Properties }
property Firstname: WideString
read Get_Firstname
write Set_Firstname;
property Lastname: WideString
read Get_Lastname
write Set_Lastname;
end;
{ Forward Decls }
TXMLBookstoreType =
class;
TXMLBookType =
class;
TXMLAuthorName =
class;
{ TXMLBookstoreType }
TXMLBookstoreType =
class(TXMLNodeCollection, IXMLBookstoreType)
protected
{ IXMLBookstoreType }
function Get_Book(
Index: Integer): IXMLBookType;
function Add: IXMLBookType;
function Insert(
const Index: Integer): IXMLBookType;
public
procedure AfterConstruction;
override;
end;
{ TXMLBookType }
TXMLBookType =
class(TXMLNode, IXMLBookType)
protected
{ IXMLBookType }
function Get_Genre: WideString;
function Get_Title: WideString;
function Get_Author: IXMLAuthorName;
function Get_Price: WideString;
procedure Set_Genre(Value: WideString);
procedure Set_Title(Value: WideString);
procedure Set_Price(Value: WideString);
public
procedure AfterConstruction;
override;
end;
{ TXMLAuthorName }
TXMLAuthorName =
class(TXMLNode, IXMLAuthorName)
protected
{ IXMLAuthorName }
function Get_Firstname: WideString;
function Get_Lastname: WideString;
procedure Set_Firstname(Value: WideString);
procedure Set_Lastname(Value: WideString);
end;
{ Global Functions }
function Getbookstore(Doc: IXMLDocument): IXMLBookstoreType;
function Loadbookstore(
const FileName: WideString): IXMLBookstoreType;
function Newbookstore: IXMLBookstoreType;
const
TargetNamespace = '
';
implementation
{ Global Functions }
function Getbookstore(Doc: IXMLDocument): IXMLBookstoreType;
begin
Result := Doc.GetDocBinding('
bookstore', TXMLBookstoreType, TargetNamespace)
as IXMLBookstoreType;
end;
function Loadbookstore(
const FileName: WideString): IXMLBookstoreType;
begin
Result := LoadXMLDocument(FileName).GetDocBinding('
bookstore', TXMLBookstoreType, TargetNamespace)
as IXMLBookstoreType;
end;
function Newbookstore: IXMLBookstoreType;
begin
Result := NewXMLDocument.GetDocBinding('
bookstore', TXMLBookstoreType, TargetNamespace)
as IXMLBookstoreType;
end;
{ TXMLBookstoreType }
procedure TXMLBookstoreType.AfterConstruction;
begin
RegisterChildNode('
book', TXMLBookType);
ItemTag := '
book';
ItemInterface := IXMLBookType;
inherited;
end;
function TXMLBookstoreType.Get_Book(
Index: Integer): IXMLBookType;
begin
Result := List[
Index]
as IXMLBookType;
end;
function TXMLBookstoreType.Add: IXMLBookType;
begin
Result := AddItem(-1)
as IXMLBookType;
end;
function TXMLBookstoreType.Insert(
const Index: Integer): IXMLBookType;
begin
Result := AddItem(
Index)
as IXMLBookType;
end;
{ TXMLBookType }
procedure TXMLBookType.AfterConstruction;
begin
RegisterChildNode('
author', TXMLAuthorName);
inherited;
end;
function TXMLBookType.Get_Genre: WideString;
begin
Result := AttributeNodes['
genre'].Text;
end;
procedure TXMLBookType.Set_Genre(Value: WideString);
begin
SetAttribute('
genre', Value);
end;
function TXMLBookType.Get_Title: WideString;
begin
Result := ChildNodes['
title'].Text;
end;
procedure TXMLBookType.Set_Title(Value: WideString);
begin
ChildNodes['
title'].NodeValue := Value;
end;
function TXMLBookType.Get_Author: IXMLAuthorName;
begin
Result := ChildNodes['
author']
as IXMLAuthorName;
end;
function TXMLBookType.Get_Price: WideString;
begin
Result := ChildNodes['
price'].Text;
end;
procedure TXMLBookType.Set_Price(Value: WideString);
begin
ChildNodes['
price'].NodeValue := Value;
end;
{ TXMLAuthorName }
function TXMLAuthorName.Get_Firstname: WideString;
begin
Result := ChildNodes['
first-name'].Text;
end;
procedure TXMLAuthorName.Set_Firstname(Value: WideString);
begin
ChildNodes['
first-name'].NodeValue := Value;
end;
function TXMLAuthorName.Get_Lastname: WideString;
begin
Result := ChildNodes['
last-name'].Text;
end;
procedure TXMLAuthorName.Set_Lastname(Value: WideString);
begin
ChildNodes['
last-name'].NodeValue := Value;
end;
end.