[英]XmlWriter The ':' character, hexadecimal value 0x3A, cannot be included in a name
I am using an XmlWriter and getting the following error:我正在使用 XmlWriter 并收到以下错误:
Invalid name character in 'news:news'. The ':' character, hexadecimal value 0x3A, cannot be included in a name.
You need to use the overload of WriteStartElement
that takes two parameters: 您需要使用WriteStartElement
两个参数的WriteStartElement
重载:
writer.WriteStartElement("news", "http://www.google.com/schemas/sitemap-news/0.9");
// Tag ----^ ^--- Namespace
I used this code:我使用了这段代码:
writer.WriteStartElement("wp","wxr_version", null);
To get this result:要得到这个结果:
<wp:wxr_version>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.