I ask a question here How to create simple XML in OmniXML and I get an answer from Gavin Watkinson.
I create the unit:
interface
uses
OmniXML, OmniXMLProperties;
type
TRow = class(TGpXMLData)
public
constructor Create(Node: IXMLNode); override;
property Id: integer index 0 read GetXMLPropInt write SetXMLPropInt;
property Name: WideString index 1 read GetXMLPropWide write SetXMLPropWide;
property Surname: WideString index 2 read GetXMLPropWide write SetXMLPropWide;
property Time: WideString index 3 read GetXMLPropWide write SetXMLPropWide;
property Old: WideString index 4 read GetXMLPropWide write SetXMLPropWide;
property Subject: WideString index 5 read GetXMLPropWide write SetXMLPropWide;
end;
TRows = class(TGpXMLList)
protected
function GetRow(Value: integer): TRow;
public
constructor Create(ParentNode: IXMLNode); reintroduce;
function Add: TRow; reintroduce;
property Rows[Value: integer]: TRow read GetRow; default;
end;
TRootsXml = class(TGpXmlDocList)
private
fRows: TRows;
public
constructor Create; reintroduce;
destructor Destroy; override;
property Ver: WideString index 0 read GetXMLAttrPropWide write SetXMLAttrPropWide;
property RootFile: WideString index 1 read GetXMLAttrPropWide write SetXMLAttrPropWide;
property Rows: TRows read fRows;
end;
implementation
constructor TRow.Create(Node: IXMLNode);
begin
inherited;
InitChildNodes(['id', 'name', 'surname', 'time', 'old', 'subjects'],
['', '', '', '', '', '']);
end;
constructor TRows.Create(parentNode: IXMLNode);
begin
inherited Create(parentNode, '', 'row', TRow);
end;
function TRows.Add: TRow;
begin
Result := TRow(inherited Add);
end;
function TRows.GetRow(Value: Integer): TRow;
begin
Result := TRow(inherited Items[Value]);
end;
constructor TRootsXml.Create;
var
xmlPI: IXMLProcessingInstruction;
begin
inherited Create('Root', '', '', nil);
xmlPI := XMLDoc.CreateProcessingInstruction('xml', 'version="1.0" encoding="utf-8"');
XMLDoc.InsertBefore(xmlPI, node);
InitChildNodes(['ver', 'file'], ['', '']);
fRows := TRows.Create(node);
end;
destructor TRootsXml.Destroy;
begin
fRows.free;
inherited;
end;
When I try to TRootsXml.ver = 'sat123';
and try to compile I get this error. 'Internal error E5912' and not compiling...
But I can build without problem and run it.
So what is wrong and what is internal error E5912?