2
如何使用类XDocument并将其属性名称设置为接受冒号字符?我收到此错误在XML属性上使用冒号字符时出错
“该':'字符,十六进制值0x3A,不能包含在名称中。”
Dim ns As XNamespace = "http://www.sitemaps.org/schemas/sitemap/0.9"
Dim xi As XNamespace = "http://www.w3.org/2001/XMLSchema-instance"
Dim sitemapValue As New XDocument(New XDeclaration("1.0", "utf-8", ""),
New XElement("urlset", New XAttribute("xmls", ns),
New XAttribute("xmls:xi", xi)))
我只是想下面使用的XDocument类下面的头输出。
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">