//创建XML
XmlDocument xmlDoc = new XmlDocument(); XmlDeclaration xmlDecl = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null);//加入XML的声明段落,<?xml version="1.0" encoding="UTF-8"?>
xmlDoc.AppendChild(xmlDecl); XmlElement listings = xmlDoc.CreateElement("", "listings", "");//加入一个根元素
listings.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");//添加属性xmlns:xsi
listings.SetAttribute("xsi:noNamespaceSchemaLocation", "http://local.google.com/local_feed.xsd");//添加属性xsi:noNamespaceSchemaLocation
xmlDoc.AppendChild(listings);
最后导出的xml文件中显示的是“noNamespaceSchemaLocation”而不是“xsi:noNamespaceSchemaLocation”
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货