首页 新闻 赞助 找找看

xml中怎么添加noNamespaceSchemaLocation和xsi

0
悬赏园豆:20 [已关闭问题] 关闭于 2014-10-16 15:23
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-
envelope.xsd">

XmlDocument xmldoc = new XmlDocument();
XmlElement xmlelem;
XmlElement data;
xmlelem = xmldoc.CreateElement("", "AmazonEnvelope", "");
//xmlelem.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
//xmlelem.SetAttribute("xsi","noNamespaceSchemaLocation", "amzn-envelope.xsd");
XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
XAttribute att = new XAttribute(xsi + "noNamespaceSchemaLocation", "amzn-envelope.xsd") ;

我直接用setAttribute不行
网上有一个用XDocument的但是我用的是XmlDocument,不想改了
问题补充:

为什么没人啊 

nbu_djw的主页 nbu_djw | 初学一级 | 园豆:20
提问于:2014-10-16 09:58
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册