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

View File

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

View File

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

View File

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