xml操作问题,谢谢 了
以下是一个xml格式:
<?xml version="1.0" encoding="GB2312" ?>
<wlfpML cnName="2010" name="wlfp2010s" version="wlfp2010" xsi:type="wlfp2010smb" xmlns="http://www.12366.ha.cn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
我新建一个空xml,把上面的加到xml中,用的是 xmlDocument控件,执行代码是:
OutXMLDoc.Active := true; //激活OutXMLDoc,自动初始化空的XML文档
OutXMLDoc.Encoding := 'GB2312'; //设置字符集
RootNode := OutXMLDoc.AddChild('wlfpML'); //建根结点
RootNode.SetAttributeNS('cnName','','2010') ;
RootNode.SetAttributeNS('Name','','wlfp2010s');
RootNode.SetAttributeNS('version','','wlfp2010');
//RootNode.SetAttributeNS('xsi:type','','wlfp2010smb'); //出错
RootNode.SetAttributeNS('xmlns','','http://www.12366.ha.cn');
RootNode.SetAttributeNS('xmlns:xsi','','http://www.w3.org/2001/XMLSchema-instance');
出错提示:引用了未声明的名称空间前缀:xsi。
请问 怎么修改, 谢谢! 在线等!