X x_coffee Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-22 #1 用DOM操作XML文件时,可以用selectNodes或selectsingleNode方法进行结点查询,但 在DELPHI中的TXMLDocument对象,我怎么也找不到这个方法,不知道该如何解决.
X xeen Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-22 #2 首先 uses xmldom 单元 procedure TForm1.Button1Click(Sender: TObject); var FindXML:IDOMNodeSelect; MyNode : IDOMNode; begin FindXML := XMLDocument.DOMDocument as IDOMNodeSelect; MyNode := FindXML.selectNode('CLAW'); showmessage(MyNode.nodename); end;
首先 uses xmldom 单元 procedure TForm1.Button1Click(Sender: TObject); var FindXML:IDOMNodeSelect; MyNode : IDOMNode; begin FindXML := XMLDocument.DOMDocument as IDOMNodeSelect; MyNode := FindXML.selectNode('CLAW'); showmessage(MyNode.nodename); end;
J jsxjd Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-24 #3 delphi 6 中有! 或自己导入 /动态创建CreateOleObject
X x_coffee Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-28 #4 to xeen: IDOMNode对象好象不能获得<info></info>间的TEXT信息,不知道有什么办法。
X x_coffee Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-28 #6 var New_Node: IDOMNode; FindXML:IDOMNodeSelect; begin FindXML := XMLDoc.DOMDocument as IDOMNodeSelect; New_node:=FindXML.selectNode('//Dat[Name=''小强'']'); end; New_node.nodeValue 是该结点的属性值 我想得到的是该结点的的内容 比如 <dat> <name>小强</name> <addr>上海</addr> </dat> 我怎么用IDOMNode得到‘上海??
var New_Node: IDOMNode; FindXML:IDOMNodeSelect; begin FindXML := XMLDoc.DOMDocument as IDOMNodeSelect; New_node:=FindXML.selectNode('//Dat[Name=''小强'']'); end; New_node.nodeValue 是该结点的属性值 我想得到的是该结点的的内容 比如 <dat> <name>小强</name> <addr>上海</addr> </dat> 我怎么用IDOMNode得到‘上海??
X xeen Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-28 #7 <name>小强</name> 被认为为如下结构: [red]<name><#text>小强</#text></name>[/red] 所以查找该node应该为: var New_Node: IDOMNode; FindXML:IDOMNodeSelect; begin FindXML := XMLDoc.DOMDocument as IDOMNodeSelect; New_node:=FindXML.selectNode('//Dat/name[text()=''小强'']'); ShowMessage(New_node.ChildNode.Item[0].nodevalue); end;
<name>小强</name> 被认为为如下结构: [red]<name><#text>小强</#text></name>[/red] 所以查找该node应该为: var New_Node: IDOMNode; FindXML:IDOMNodeSelect; begin FindXML := XMLDoc.DOMDocument as IDOMNodeSelect; New_node:=FindXML.selectNode('//Dat/name[text()=''小强'']'); ShowMessage(New_node.ChildNode.Item[0].nodevalue); end;