开发者

MSXML: How can i modify nodes returned by SelectNodes method

Is it possible to modify XML and/or Text of nodes returned by SelectNodes method ?

When i am using SelectSingleNode method i always can modify XML and Text property of returned node:

vXML := CreateOleObject('MSXML2.DOMDocument.6.0')
vXML.Load('...');
vDoc :=  vXML.DocumentElement;
vNode := vDoc.SelectSingleNode(XPath);
vNode.XML := 'My value'; // Works here

But when i am trying to change nodes returned by SelectNodes method i'v got "Invalid number of parameters" OLE-Exception

vValue := vDoc.SelectNodes(XPath);
if vValue.Length>0 then
begin
  N := vValue.Length;
  for I := 0 to N-1 do
    vValue.Item(I).XML := ''; // Exception here
end;

Is it possible to chan开发者_运维技巧ge XML of nodes returned by SelectNode method ?


Try vValue.Item(I).Text := '' (only for XMLDOMElement type of nodes). And you should tag your question with the programming language you are using, looks like Pascal. Is this Delphi?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜