+ Implemented TDOMDocument.xmlStandalone property

git-svn-id: trunk@18033 -
This commit is contained in:
sergei 2011-07-29 04:03:30 +00:00
parent 7e102d12ca
commit 70bc36da85
4 changed files with 20 additions and 0 deletions

View File

@ -449,6 +449,7 @@ type
FNodeLists: THashTable;
FMaxPoolSize: Integer;
FPools: PNodePoolArray;
FXmlStandalone: Boolean;
function GetDocumentElement: TDOMElement;
function GetDocType: TDOMDocumentType;
function GetNodeType: Integer; override;
@ -462,6 +463,7 @@ type
procedure NodeListDestroyed(aList: TDOMNodeList);
function Alloc(AClass: TDOMNodeClass): TDOMNode;
procedure SetXMLVersion(const aValue: DOMString); virtual;
procedure SetXMLStandalone(aValue: Boolean); virtual;
public
function IndexOfNS(const nsURI: DOMString; AddIfAbsent: Boolean = False): Integer;
function InsertBefore(NewChild, RefChild: TDOMNode): TDOMNode; override;
@ -497,6 +499,7 @@ type
// DOM level 3:
property documentURI: DOMString read FURI write FURI;
property XMLVersion: DOMString read GetXMLVersion write SetXMLVersion;
property XMLStandalone: Boolean read FXmlStandalone write SetXmlStandalone;
// Extensions to DOM interface:
constructor Create; virtual;
destructor Destroy; override;
@ -509,6 +512,7 @@ type
TXMLDocument = class(TDOMDocument)
protected
procedure SetXMLVersion(const aValue: DOMString); override;
procedure SetXMLStandalone(aValue: Boolean); override;
public
// These fields are extensions to the DOM interface:
StylesheetType, StylesheetHRef: DOMString;
@ -2176,6 +2180,7 @@ begin
Clone.FInputEncoding := FInputEncoding;
Clone.FXMLEncoding := FXMLEncoding;
Clone.FXMLVersion := FXMLVersion;
Clone.FXMLStandalone := FXMLStandalone;
Clone.FURI := FURI;
if deep then
begin
@ -2563,6 +2568,11 @@ begin
raise EDOMNotSupported.Create('DOMDocument.SetXMLVersion');
end;
procedure TDOMDocument.SetXMLStandalone(aValue: Boolean);
begin
raise EDOMNotSupported.Create('DOMDocument.SetXMLStandalone');
end;
constructor TXMLDocument.Create;
begin
inherited Create;
@ -2619,6 +2629,11 @@ begin
raise EDOMNotSupported.Create('XMLDocument.SetXMLVersion');
end;
procedure TXMLDocument.SetXMLStandalone(aValue: Boolean);
begin
FXmlStandalone := aValue;
end;
{ TDOMNode_NS }
function TDOMNode_NS.GetNodeName: DOMString;

View File

@ -1324,6 +1324,7 @@ begin
if FSource.FXMLVersion <> xmlVersionUnknown then
TDOMTopNodeEx(TDOMNode(doc)).FXMLVersion := FSource.FXMLVersion;
TDOMTopNodeEx(TDOMNode(doc)).FXMLEncoding := FSource.FXMLEncoding;
doc.XMLStandalone := FStandalone;
FNext := xtText;
ParseContent(doc);

View File

@ -684,6 +684,9 @@ begin
wrtChr('"');
end;
*)
if TXMLDocument(node).xmlStandalone then
wrtStr(' standalone="yes"');
wrtStr('?>');
// TODO: now handled as a regular PI, remove this?

View File

@ -289,6 +289,7 @@
<item id="inputEncoding"/>
<item id="xmlEncoding"/>
<item id="xmlVersion" type="prop"/>
<item id="xmlStandalone" type="prop"/>
<!-- XPath -->