mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-05 23:27:48 +01:00
* Applied patch from Daniel Garpary to be able to create custom TDomElement descendents
git-svn-id: trunk@25572 -
This commit is contained in:
parent
973c0687fc
commit
1eb2308ffa
@ -274,6 +274,7 @@ type
|
||||
end;
|
||||
|
||||
TDOMNodeClass = class of TDOMNode;
|
||||
TDOMElementClass = class of TDOMElement;
|
||||
|
||||
{ The following class is an implementation specific extension, it is just an
|
||||
extended implementation of TDOMNode, the generic DOM::Node interface
|
||||
@ -499,7 +500,9 @@ type
|
||||
|
||||
// DOM level 2 methods
|
||||
function ImportNode(ImportedNode: TDOMNode; Deep: Boolean): TDOMNode;
|
||||
function CreateElementNS(const nsURI, QualifiedName: DOMString): TDOMElement;
|
||||
function CreateElementNS(const nsURI, QualifiedName: DOMString): TDOMElement; overload;
|
||||
function CreateElementNS(const nsURI, QualifiedName: DOMString;
|
||||
AClass: TDOMElementClass): TDOMElement; overload;
|
||||
function CreateAttributeNS(const nsURI, QualifiedName: DOMString): TDOMAttr;
|
||||
function GetElementsByTagNameNS(const nsURI, alocalName: DOMString): TDOMNodeList;
|
||||
function GetElementById(const ElementID: DOMString): TDOMElement;
|
||||
@ -2572,6 +2575,12 @@ end;
|
||||
|
||||
function TDOMDocument.CreateElementNS(const nsURI,
|
||||
QualifiedName: DOMString): TDOMElement;
|
||||
begin
|
||||
result:=CreateElementNS(nsURI, QualifiedName, TDOMElement);
|
||||
end;
|
||||
|
||||
function TDOMDocument.CreateElementNS(const nsURI, QualifiedName: DOMString;
|
||||
AClass: TDOMElementClass): TDOMElement; overload;
|
||||
var
|
||||
PrefIdx: Integer;
|
||||
nsidx: PHashItem;
|
||||
@ -2579,7 +2588,7 @@ begin
|
||||
PrefIdx := ValidateQName(nsURI, QualifiedName, nsidx);
|
||||
if PrefIdx < 0 then
|
||||
raise EDOMError.Create(-PrefIdx, 'Document.CreateElementNS');
|
||||
TDOMNode(Result) := Alloc(TDOMElement);
|
||||
TDOMNode(Result) := Alloc(AClass);
|
||||
Result.Create(Self);
|
||||
Result.FNSI.QName := FNames.FindOrAdd(DOMPChar(QualifiedName), Length(QualifiedName));
|
||||
Result.FNSI.NSIndex := Word(IndexOfNS(nsURI, True));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user