{*******************************************************} { } { AutoDomCore.pas } { } { } { Copyright (c) 2006-2008 Shenturk } { Create: 07.10.2006 } { Update: 11.05.2008 } { } {*******************************************************} unit AutoDomCore; interface uses Windows, SysUtils, Classes, ComObj, ActiveX, SelfSozluk_TLB, StdVcl, DomCore, HtmlParser; type { INodeRef } INodeRef = interface ['{58038004-7BED-4D3B-A5EF-0DA477B95AC9}'] function GetNode: TNode; safecall; end; { IAutoNodeListRef } INodeListRef = interface ['{B3D385F4-E0C8-4CC8-A59C-69A38CE9A1D8}'] function GetNodeList: TNodeList; safecall; end; { Forward Declarations } TAutoNode = class; TAutoDocument = class; { TAutoNodeList } TAutoNodeList = class(TAutoIntfObject, INodeListRef, INodeList) private FNodeList: TNodeList; FOwnerNode: TAutoNode; protected { INodeListRef } function GetNodeList: TNodeList; safecall; { INodeList } function Get_length: Integer; safecall; function Get_item(Index: Integer): INode; safecall; public constructor Create(nodeList: TNodeList; ownerNode: TAutoNode; const DispIntf: TGUID); destructor Destroy; override; property OwnerNode: TAutoNode read FOwnerNode; end; { !! INamedNodeMap, Standart DOM da INodeList ten turemiyor !! } { TAutoNamedNodeMap } TAutoNamedNodeMap = class(TAutoNodeList, INamedNodeMap) private FNamedNodeMap: TNamedNodeMap; FOwnerNode: TAutoNode; function GetNamedNodeMap: TNamedNodeMap; protected function getNamedItem(const name: WideString): INode; safecall; function setNamedItem(const arg: INode): INode; safecall; function removeNamedItem(const name: WideString): INode; safecall; function getNamedItemNS(const namespaceURI, localName: WideString): INode; safecall; function setNamedItemNS(const arg: INode): INode; safecall; function removeNamedItemNS(const namespaceURI, localName: WideString): INode; safecall; public constructor Create(namedNodeMap: TNamedNodeMap; ownerNode: TAutoNode); property NamedNodeMap: TNamedNodeMap read GetNamedNodeMap; end; { TAutoNode } TAutoNode = class(TAutoIntfObject, INodeRef, INode) private { Self } FNode: TNode; FAutoOwnerDocument: TAutoDocument; { TNode } FChildNodes: INodeList; FOwnerDocument: IDocument; FAttributes: INamedNodeMap; protected { IAutoNodeRef } function GetNode: TNode; safecall; { INode Property Acessors } function Get_nodeName: WideString; safecall; function Get_nodeValue: WideString; safecall; procedure Set_nodeValue(const Value: WideString); safecall; function Get_nodeType: Integer; safecall; function Get_parentNode: INode; safecall; function Get_childNodes: INodeList; safecall; function Get_firstChild: INode; safecall; function Get_lastChild: INode; safecall; function Get_previousSibling: INode; safecall; function Get_nextSibling: INode; safecall; function Get_attributes: INamedNodeMap; safecall; function Get_ownerDocument: IDocument; safecall; function Get_namespaceURI: WideString; safecall; function Get_prefix: WideString; safecall; function Get_localName: WideString; safecall; function Get_innerText: WideString; safecall; function Get_innerHtml: WideString; safecall; function Get_outerText: WideString; safecall; function Get_outerHtml: WideString; safecall; { INode Methods } function insertBefore(const newChild: INode; const refChild: INode): INode; safecall; function replaceChild(const newChild: INode; const oldChild: INode): INode; safecall; function removeChild(const oldChild: INode): INode; safecall; function appendChild(const newChild: INode): INode; safecall; function hasChildNodes: WordBool; safecall; function cloneNode(deep: WordBool): INode; safecall; function supports(const feature: WideString; const version: WideString): WordBool; safecall; procedure normalize; safecall; function hasAttributes: WordBool; safecall; function getElementsByTagName(const name: WideString): INodeList; safecall; function getElementsByTagNameNS(const namespaceURI, localName: WideString): INodeList; safecall; function getElementById(const elementId: WideString): IElement; safecall; procedure clearAttributes; safecall; public constructor Create(ANode: TNode; AOwnerDocument: TAutoDocument; const DispIntf: TGUID); destructor Destroy; override; property Node: TNode read FNode; property OwnerDocument: TAutoDocument read FAutoOwnerDocument; end; { TAutoDocument } TAutoDocument = class(TAutoNode, IDocument) private function GetDocument: TDocument; protected { IDocument Methods } function Get_doctype: IDocumentType; safecall; function Get_domImplementation: IDomImplementation; safecall; function Get_documentElement: IElement; safecall; procedure Set_documentElement(const Value: IElement); safecall; function createElement(const tagName: WideString): IElement; safecall; function createDocumentFragment: IDocumentFragment; safecall; function createTextNode(const data: WideString): ITextNode; safecall; function createComment(const data: WideString): IComment; safecall; function createCDATASection(const data: WideString): ICDATASection; safecall; function createProcessingInstruction(const target, data: WideString): IProcessingInstruction; safecall; function createAttribute(const name: WideString): IAttr; safecall; function createEntityReference(const name: WideString): IEntityReference; safecall; function importNode(const importedNode: INode; deep: WordBool): INode; safecall; function createElementNS(const namespaceURI, qualifiedName: WideString): IElement; safecall; function createAttributeNS(const namespaceURI, qualifiedName: WideString): IAttr; safecall; public constructor Create(document: TDocument); property Document: TDocument read GetDocument; end; { TAutoElement } TAutoElement = class(TAutoNode, IElement) private function GetElement: TElement; protected { IAutoElement Property Acessors } function Get_tagName: WideString; safecall; { IAutoElement Methods } function getAttribute(const name: WideString): WideString; safecall; function getAttributeNode(const name: WideString): IAttr; safecall; function setAttributeNode(const newAttr: IAttr): IAttr; safecall; function removeAttributeNode(const oldAttr: IAttr): IAttr; safecall; function getAttributeNS(const namespaceURI: WideString; const localName: WideString): WideString; safecall; function getAttributeNodeNS(const namespaceURI: WideString; const localName: WideString): IAttr; safecall; function setAttributeNodeNS(const newAttr: IAttr): IAttr; safecall; function hasAttribute(const name: WideString): WordBool; safecall; function hasAttributeNS(const namespaceURI, localName: WideString): WordBool; safecall; procedure setAttribute(const name: WideString; const value: WideString); safecall; procedure removeAttribute(const name: WideString); safecall; procedure setAttributeNS(const namespaceURI: WideString; const qualifiedName: WideString; const value: WideString); safecall; procedure removeAttributeNS(const namespaceURI: WideString; const localName: WideString); safecall; public constructor Create(element: TElement; ownerDocument: TAutoDocument); property Element: TElement read GetElement; end; { TAutoAttr } TAutoAttr = class(TAutoNode, IAttr) private function GetAttribute: TAttr; protected { IAutoAttr Property Acessors } function Get_name: WideString; safecall; function Get_specified: WordBool; safecall; function Get_value: WideString; safecall; procedure Set_value(const Value: WideString); safecall; function Get_ownerElement: IElement; safecall; public constructor Create(attribute: TAttr; ownerDocument: TAutoDocument); property Attribute: TAttr read GetAttribute; end; { TAutoCharacterData } TAutoCharacterData = class(TAutoNode, ICharacterData) private function GetCharacterData: TCharacterData; protected function Get_data: WideString; safecall; procedure Set_data(const Value: WideString); safecall; function Get_length: Integer; safecall; function substringData(offset: Integer; count: Integer): WideString; safecall; procedure appendData(const arg: WideString); safecall; procedure deleteData(offset: Integer; count: Integer); safecall; procedure insertData(offset: Integer; const arg: WideString); safecall; procedure replaceData(offset: Integer; count: Integer; const arg: WideString); safecall; public constructor Create(CharacterData: TCharacterData; ownerDocument: TAutoDocument; const DispIntf: TGUID); property CharacterData: TCharacterData read GetCharacterData; end; { TAutoTextNode } TAutoTextNode = class(TAutoCharacterData, ITextNode) private function GetTextNode: TTextNode; protected function splitText(offset: Integer): ITextNode; safecall; public constructor Create(TextNode: TTextNode; ownerDocument: TAutoDocument; const DispIntf: TGUID); property TextNode: TTextNode read GetTextNode; end; { TAutoComment } TAutoComment = class(TAutoCharacterData, IComment) end; { TAutoCDATASection } TAutoCDATASection = class(TAutoTextNode, ICDATASection) end; { TAutoDocumentType } TAutoDocumentType = class(TAutoNode, IDocumentType) private function GetDocumentType: TDocumentType; protected { IDocumentType } function Get_name: WideString; safecall; function Get_entities: INamedNodeMap; safecall; function Get_notations: INamedNodeMap; safecall; function Get_publicId: WideString; safecall; function Get_systemId: WideString; safecall; function Get_internalSubset: WideString; safecall; public constructor Create(documentType: TDocumentType; ownerDocument: TAutoDocument); property DocumentType: TDocumentType read GetDocumentType; end; implementation uses ComServ2007; { // Bazi siniflarin Create'i farkli oldugundan bu fonksiyon yemez! function MakeNode(Node: TNode; AutoDocument: TAutoDocument): IAutoNode; const NodeClasses: array [xdom.TDomNodeType] of TOXAutoNodeClass = (TOXAutoNode, TOXAutoElement, TOXAutoAttr, TOXAutoText, TOXAutoCDataSection, TOXAutoEntityReference, TOXAutoEntity, TOXAutoProcessingInstruction, TOXAutoComment, TOXAutoDocument, TOXAutoDocumentType, TOXAutoDocumentFragment, TOXAutoNotation); begin if Node <> nil then Result := NodeClasses[Node.NodeType].Create(Node, OXAutoDocument) else Result := nil; end; } { MakeDOMElement } function MakeDOMElement(element: TElement; ownerDocument: TAutoDocument): IElement; begin { if not Assigned(element) then raise DomException.Create(0); Result := TAutoElement.Create(element, ownerDocument); } Result := nil; if Assigned(element) then Result := TAutoElement.Create(element, ownerDocument); end; { MakeDOMAttr } function MakeDOMAttr(Attribute: TAttr; ownerDocument: TAutoDocument): IAttr; begin Result := TAutoAttr.Create(Attribute, ownerDocument); end; { MakeDOMTextNode } function MakeDOMTextNode(TextNode: TTextNode; ownerDocument: TAutoDocument): ITextNode; begin Result := TAutoTextNode.Create(TextNode, ownerDocument, ITextNode); end; { MakeDOMComment } function MakeDOMComment(Comment: TComment; ownerDocument: TAutoDocument): IComment; begin Result := TAutoComment.Create(Comment, ownerDocument, IComment); end; { MakeDOMCDATASection } function MakeDOMCDATASection(CDATASection: TCDATASection; ownerDocument: TAutoDocument): ICDATASection; begin Result := TAutoCDATASection.Create(CDATASection, ownerDocument, ICDATASection); end; { MakeDOMNodeList } function MakeDOMNodeList(nodeList: TNodeList; ownerNode: TAutoNode): INodeList; begin Result := TAutoNodeList.Create(nodeList, ownerNode, INodeList); end; { MakeDOMNamedNodeMap } function MakeDOMNamedNodeMap(namedNodeMap: TNamedNodeMap; ownerNode: TAutoNode): INamedNodeMap; begin Result := TAutoNamedNodeMap.Create(namedNodeMap, ownerNode); end; { MakeDOMDocument } function MakeDOMDocument(document: TDocument): IDocument; begin Result := TAutoDocument.Create(document); end; { MakeDOMDocumentType } function MakeDOMDocumentType(documentType: TDocumentType; ownerDocument: TAutoDocument): IDocumentType; begin Result := TAutoDocumentType.Create(documentType, ownerDocument); end; { MakeDomImplementation } function MakeDomImplementation(DomImplementation: DomImplementation): IDomImplementation; begin { not yet } Result := nil; end; { MakeDOMNode } function MakeDOMNode(node: TNode; ownerDocument: TAutoDocument): INode; begin case node.nodeType of ELEMENT_NODE : Result := MakeDOMElement(node as TElement, ownerDocument); ATTRIBUTE_NODE : Result := MakeDOMAttr(Node as TAttr, ownerDocument); TEXT_NODE : Result := MakeDOMTextNode(Node as TTextNode, ownerDocument); CDATA_SECTION_NODE : Result := MakeDOMCDATASection(Node as TCDATASection, ownerDocument); //ENTITY_NODE : Result := nil; //PROCESSING_INSTRUCTION_NODE: Result := nil; COMMENT_NODE : Result := MakeDOMComment(Node as TComment, ownerDocument); DOCUMENT_NODE : Result := MakeDOMDocument(Node as TDocument); DOCUMENT_TYPE_NODE : Result := MakeDOMDocumentType(Node as TDocumentType, ownerDocument); // DOCUMENT_FRAGMENT_NODE : Result := nil; // NOTATION_NODE : Result := nil; else Result := TAutoNode.Create(node, ownerDocument, INode); end; end; { GetNodeRef } function GetNodeRef(const Node: INode): TNode; begin if not Assigned(Node) then raise DomException.Create(0); Result := (Node as INodeRef).GetNode; end; { TAutoNodeList } constructor TAutoNodeList.Create(nodeList: TNodeList; ownerNode: TAutoNode; const DispIntf: TGUID); begin inherited Create(ComServer.TypeLib, DispIntf); FNodeList := nodeList; FOwnerNode := ownerNode; end; destructor TAutoNodeList.Destroy; begin FNodeList := nil; inherited Destroy; end; function TAutoNodeList.Get_length: Integer; begin Result := FNodeList.length; end; function TAutoNodeList.GetNodeList: TNodeList; begin Result := FNodeList; end; function TAutoNodeList.Get_item(Index: Integer): INode; var Item: TNode; begin Item := FNodeList.item(index); Result := MakeDOMNode(Item, FOwnerNode.FAutoOwnerDocument); end; { TAutoNode } function TAutoNode.appendChild(const newChild: INode): INode; begin Result := MakeDOMNode(Node.appendChild(GetNodeRef(newChild)), FAutoOwnerDocument); end; procedure TAutoNode.clearAttributes; begin Node.clearAttributes; end; function TAutoNode.cloneNode(deep: WordBool): INode; begin Result := MakeDOMNode(Node.cloneNode(deep), FAutoOwnerDocument); end; constructor TAutoNode.Create(ANode: TNode; AOwnerDocument: TAutoDocument; const DispIntf: TGUID); begin inherited Create(ComServer.TypeLib, DispIntf); FNode := ANode; FAutoOwnerDocument := AOwnerDocument; end; destructor TAutoNode.Destroy; begin { OutputDebugString('TAutoNode.Destroy'); } FNode := nil; FOwnerDocument := nil; inherited Destroy; end; function TAutoNode.getElementById(const elementId: WideString): IElement; begin Result := MakeDOMElement(Node.getElementById(elementId), FAutoOwnerDocument); end; function TAutoNode.getElementsByTagName( const name: WideString): INodeList; begin Result := MakeDOMNodeList(Node.getElementsByTagName(name), Self); end; function TAutoNode.getElementsByTagNameNS(const namespaceURI, localName: WideString): INodeList; begin Result := MakeDOMNodeList(Node.getElementsByTagNameNS(namespaceURI, localName), Self); end; function TAutoNode.GetNode: TNode; begin Result := FNode; end; function TAutoNode.Get_attributes: INamedNodeMap; begin if not Assigned(FAttributes) and Assigned(Node.Attributes) then FAttributes := MakeDOMNamedNodeMap(Node.Attributes, Self); Result := FAttributes; end; function TAutoNode.Get_childNodes: INodeList; begin if not Assigned(FChildNodes) then FChildNodes := MakeDOMNodeList(Node.childNodes, Self); Result := FChildNodes; end; function TAutoNode.Get_firstChild: INode; begin Result := MakeDOMNode(Node.firstChild, FAutoOwnerDocument); end; function TAutoNode.Get_innerHtml: WideString; begin Result := Node.innerHtml; end; function TAutoNode.Get_innerText: WideString; begin Result := Node.innerText; end; function TAutoNode.Get_lastChild: INode; begin Result := MakeDOMNode(Node.lastChild, FAutoOwnerDocument); end; function TAutoNode.Get_localName: WideString; begin Result := Node.localName; end; function TAutoNode.Get_namespaceURI: WideString; begin Result := Node.namespaceURI; end; function TAutoNode.Get_nextSibling: INode; begin Result := MakeDOMNode(Node.nextSibling, FAutoOwnerDocument); end; function TAutoNode.Get_nodeName: WideString; begin Result := Node.nodeName; end; function TAutoNode.Get_nodeType: Integer; begin Result := Node.nodeType; end; function TAutoNode.Get_nodeValue: WideString; begin Result := Node.nodeValue; end; function TAutoNode.Get_outerHtml: WideString; begin Result := Node.outerHtml; end; function TAutoNode.Get_outerText: WideString; begin Result := Node.outerText; end; function TAutoNode.Get_ownerDocument: IDocument; begin if not Assigned(FOwnerDocument) then FOwnerDocument := MakeDOMDocument(Node.ownerDocument); Result := FOwnerDocument; end; function TAutoNode.Get_parentNode: INode; begin Result := MakeDOMNode(Node.parentNode, FAutoOwnerDocument); end; function TAutoNode.Get_prefix: WideString; begin Result := Node.prefix; end; function TAutoNode.Get_previousSibling: INode; begin Result := MakeDOMNode(Node.previousSibling, FAutoOwnerDocument); end; function TAutoNode.hasAttributes: WordBool; begin Result := Node.hasAttributes; end; function TAutoNode.hasChildNodes: WordBool; begin Result := Node.hasChildNodes; end; function TAutoNode.insertBefore(const newChild, refChild: INode): INode; begin Result := MakeDOMNode(Node.insertBefore(GetNodeRef(newChild), GetNodeRef(refChild)), FAutoOwnerDocument); end; procedure TAutoNode.normalize; begin Node.normalize; end; function TAutoNode.removeChild(const oldChild: INode): INode; begin Result := MakeDOMNode(Node.removeChild(GetNodeRef(oldChild)), FAutoOwnerDocument); end; function TAutoNode.replaceChild(const newChild, oldChild: INode): INode; begin Result := MakeDOMNode(Node.replaceChild(GetNodeRef(newChild), GetNodeRef(oldChild)), FAutoOwnerDocument); end; procedure TAutoNode.Set_nodeValue(const Value: WideString); begin Node.nodeValue := Value; end; function TAutoNode.supports(const feature, version: WideString): WordBool; begin Result := Node.isSupported(feature, version); end; { TAutoDocument } constructor TAutoDocument.Create(document: TDocument); begin inherited Create(document, nil, IDocument); end; function TAutoDocument.createAttribute(const name: WideString): IAttr; begin Result := MakeDOMAttr(Document.createAttribute(name), Self); end; function TAutoDocument.createAttributeNS(const namespaceURI, qualifiedName: WideString): IAttr; begin Result := MakeDOMAttr(Document.createAttributeNS(namespaceURI, qualifiedName), Self); end; function TAutoDocument.createCDATASection( const data: WideString): ICDATASection; begin Result := MakeDOMCDATASection(Document.createCDATASection(data), Self); end; function TAutoDocument.createComment(const data: WideString): IComment; begin Result := MakeDOMComment(Document.createComment(data), Self); end; function TAutoDocument.createDocumentFragment: IDocumentFragment; begin { not yet } Result := nil; end; function TAutoDocument.createElement(const tagName: WideString): IElement; begin Result := MakeDOMElement(Document.createElement(tagName), Self); end; function TAutoDocument.createElementNS(const namespaceURI, qualifiedName: WideString): IElement; begin Result := MakeDOMElement(Document.createElementNS(namespaceURI, qualifiedName), Self); end; function TAutoDocument.createEntityReference( const name: WideString): IEntityReference; begin { not yet } Result := nil; end; function TAutoDocument.createProcessingInstruction(const target, data: WideString): IProcessingInstruction; begin { not yet } Result := nil; end; function TAutoDocument.createTextNode(const data: WideString): ITextNode; begin Result := MakeDOMTextNode(Document.createTextNode(data), Self); end; function TAutoDocument.GetDocument: TDocument; begin Result := Node as TDocument; end; function TAutoDocument.Get_doctype: IDocumentType; begin Result := MakeDOMDocumentType(Document.doctype, Self); end; function TAutoDocument.Get_documentElement: IElement; begin Result := MakeDOMElement(Document.documentElement, Self); end; function TAutoDocument.Get_domImplementation: IDomImplementation; begin { Not supported } Result := nil; end; function TAutoDocument.importNode(const importedNode: INode; deep: WordBool): INode; begin Result := MakeDOMNode(Document.importNode(GetNodeRef(importedNode), deep), Self); end; procedure TAutoDocument.Set_documentElement(const Value: IElement); begin { Not supported } { Document.documentElement := GetNodeRef(Value) as TElement; } end; { TAutoElement } constructor TAutoElement.Create(element: TElement; ownerDocument: TAutoDocument); begin inherited Create(element, ownerDocument, IElement); end; function TAutoElement.getAttribute(const name: WideString): WideString; begin Result := Element.getAttribute(name); end; function TAutoElement.getAttributeNode(const name: WideString): IAttr; begin Result := MakeDOMAttr(Element.getAttributeNode(name), Self.ownerDocument); end; function TAutoElement.getAttributeNodeNS(const namespaceURI, localName: WideString): IAttr; begin Result := MakeDOMAttr(Element.getAttributeNodeNS(namespaceURI, localName), Self.ownerDocument); end; function TAutoElement.getAttributeNS(const namespaceURI, localName: WideString): WideString; begin Result := Element.getAttributeNS(namespaceURI, localName); end; function TAutoElement.GetElement: TElement; begin Result := Node as TElement; end; function TAutoElement.Get_tagName: WideString; begin Result := Element.tagName; end; function TAutoElement.hasAttribute(const name: WideString): WordBool; begin Result := Element.hasAttribute(name); end; function TAutoElement.hasAttributeNS(const namespaceURI, localName: WideString): WordBool; begin Result := Element.hasAttributeNS(namespaceURI, localName); end; procedure TAutoElement.removeAttribute(const name: WideString); begin Element.removeAttribute(name); end; function TAutoElement.removeAttributeNode( const oldAttr: IAttr): IAttr; begin Result := MakeDOMAttr(Element.removeAttributeNode(GetNodeRef(oldAttr) as TAttr), Self.ownerDocument); end; procedure TAutoElement.removeAttributeNS(const namespaceURI, localName: WideString); begin Element.removeAttributeNS(namespaceURI, localName); end; procedure TAutoElement.setAttribute(const name, value: WideString); begin Element.setAttribute(name, value); end; function TAutoElement.setAttributeNode(const newAttr: IAttr): IAttr; begin Result := MakeDOMAttr(Element.setAttributeNode(GetNodeRef(newAttr) as TAttr), Self.ownerDocument); end; function TAutoElement.setAttributeNodeNS(const newAttr: IAttr): IAttr; begin Result := MakeDOMAttr(Element.setAttributeNodeNS(GetNodeRef(newAttr) as TAttr), Self.ownerDocument); end; procedure TAutoElement.setAttributeNS(const namespaceURI, qualifiedName, value: WideString); begin Element.setAttributeNS(namespaceURI, qualifiedName, value); end; { TAutoNamedNodeMap } constructor TAutoNamedNodeMap.Create(namedNodeMap: TNamedNodeMap; ownerNode: TAutoNode); begin inherited Create(namedNodeMap, ownerNode, INamedNodeMap); FNamedNodeMap := namedNodeMap; FOwnerNode := ownerNode; end; function TAutoNamedNodeMap.getNamedItem(const name: WideString): INode; begin Result := MakeDOMNode(NamedNodeMap.getNamedItem(name), FOwnerNode.OwnerDocument); end; function TAutoNamedNodeMap.getNamedItemNS(const namespaceURI, localName: WideString): INode; begin Result := MakeDOMNode(NamedNodeMap.getNamedItemNS(namespaceURI, localName), FOwnerNode.OwnerDocument); end; function TAutoNamedNodeMap.GetNamedNodeMap: TNamedNodeMap; begin Result := FNamedNodeMap; end; function TAutoNamedNodeMap.removeNamedItem( const name: WideString): INode; begin Result := MakeDOMNode(NamedNodeMap.removeNamedItem(name), FOwnerNode.OwnerDocument); end; function TAutoNamedNodeMap.removeNamedItemNS(const namespaceURI, localName: WideString): INode; begin Result := MakeDOMNode(NamedNodeMap.removeNamedItemNS(namespaceURI, localName), FOwnerNode.OwnerDocument); end; function TAutoNamedNodeMap.setNamedItem(const arg: INode): INode; begin Result := MakeDOMNode(NamedNodeMap.SetNamedItem(GetNodeRef(arg)), FOwnerNode.ownerDocument); end; function TAutoNamedNodeMap.setNamedItemNS(const arg: INode): INode; begin Result := MakeDOMNode(NamedNodeMap.SetNamedItemNS(GetNodeRef(arg)), FOwnerNode.ownerDocument); end; { TAutoAttr } constructor TAutoAttr.Create(attribute: TAttr; ownerDocument: TAutoDocument); begin inherited Create(attribute, ownerDocument, IAttr); end; function TAutoAttr.GetAttribute: TAttr; begin Result := Node as TAttr; end; function TAutoAttr.Get_name: WideString; begin Result := Attribute.name; end; function TAutoAttr.Get_ownerElement: IElement; begin Result := MakeDOMElement(Attribute.ownerElement, Self.OwnerDocument); end; function TAutoAttr.Get_specified: WordBool; begin Result := Attribute.specified; end; function TAutoAttr.Get_value: WideString; begin Result := Attribute.Value; end; procedure TAutoAttr.Set_value(const Value: WideString); begin Attribute.Value := Value; end; { TAutoCharacterData } procedure TAutoCharacterData.appendData(const arg: WideString); begin CharacterData.appendData(arg); end; constructor TAutoCharacterData.Create(CharacterData: TCharacterData; ownerDocument: TAutoDocument; const DispIntf: TGUID); begin inherited Create(CharacterData, ownerDocument, DispIntf); end; procedure TAutoCharacterData.deleteData(offset, count: Integer); begin CharacterData.deleteData(offset, count); end; function TAutoCharacterData.GetCharacterData: TCharacterData; begin Result := Node as TCharacterData; end; function TAutoCharacterData.Get_data: WideString; begin Result := CharacterData.data; end; function TAutoCharacterData.Get_length: Integer; begin Result := CharacterData.length; end; procedure TAutoCharacterData.insertData(offset: Integer; const arg: WideString); begin CharacterData.insertData(offset, arg); end; procedure TAutoCharacterData.replaceData(offset, count: Integer; const arg: WideString); begin CharacterData.replaceData(offset, count, arg); end; procedure TAutoCharacterData.Set_data(const Value: WideString); begin CharacterData.data := Value; end; function TAutoCharacterData.substringData(offset, count: Integer): WideString; begin CharacterData.substringData(offset, count); end; { TAutoTextNode } constructor TAutoTextNode.Create(TextNode: TTextNode; ownerDocument: TAutoDocument; const DispIntf: TGUID); begin inherited Create(TextNode, ownerDocument, DispIntf); end; function TAutoTextNode.GetTextNode: TTextNode; begin Result := Node as TTextNode; end; function TAutoTextNode.splitText(offset: Integer): ITextNode; begin Result := MakeDOMTextNode(TextNode.splitText(offset), Self.ownerDocument); end; { TAutoDocumentType } constructor TAutoDocumentType.Create(documentType: TDocumentType; ownerDocument: TAutoDocument); begin inherited Create(documentType, ownerDocument, IDocumentType); end; function TAutoDocumentType.GetDocumentType: TDocumentType; begin Result := Node as TDocumentType; end; function TAutoDocumentType.Get_entities: INamedNodeMap; begin Result := MakeDOMNamedNodeMap(DocumentType.entities, Self.OwnerDocument) end; function TAutoDocumentType.Get_internalSubset: WideString; begin Result := DocumentType.internalSubset; end; function TAutoDocumentType.Get_name: WideString; begin Result := DocumentType.name; end; function TAutoDocumentType.Get_notations: INamedNodeMap; begin Result := MakeDOMNamedNodeMap(DocumentType.notations, Self.OwnerDocument) end; function TAutoDocumentType.Get_publicId: WideString; begin Result := DocumentType.publicId; end; function TAutoDocumentType.Get_systemId: WideString; begin Result := DocumentType.systemId; end; end.