简体   繁体   English

XmlWriter ':' 字符,十六进制值 0x3A,不能包含在名称中

[英]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.

相关问题 “&#39;:&#39;字符,十六进制值0x3A,不能包含在名称中” - “The ':' character, hexadecimal value 0x3A, cannot be included in a name” &#39;:&#39; 字符,十六进制值 0x3A,不能包含在名称中 - The ':' character, hexadecimal value 0x3A, cannot be included in a name Xml到列表代码出错。 &#39;:&#39;字符,十六进制值0x3A,不能包含在名称中 - Error in Xml to List code. The ':' character, hexadecimal value 0x3A, cannot be included in a name RestSharp 请求错误? , XML , &#39;:&#39; 字符,十六进制值 0x3A,不能包含在名称中 - Error in RestSharp Request? , XML , The ':' character, hexadecimal value 0x3A, cannot be included in a name System.Xml.XmlException: &#39;:&#39; 字符,十六进制值 0x3A,不能包含在名称中 - System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name System.Xml.XmlException:“‘:’字符,十六进制值 0x3A,不能包含在名称中。” - System.Xml.XmlException: „The ':' character, hexadecimal value 0x3A, cannot be included in a name.” '=' 字符,十六进制值 0x3D,不能包含在名称中 - The '=' character, hexadecimal value 0x3D, cannot be included in a name &#39;;&#39; 字符,十六进制值0x3B,不能包含在名称中 - The ';' character, hexadecimal value 0x3B, cannot be included in a name 深入研究XML(Windows Phone)世界,我不理解(名称中不能包含&#39;&#39;字符,十六进制值0x20。) - Delving into the world of XML (Windows Phone) Error I dont understand (The ' ' character, hexadecimal value 0x20, cannot be included in a name.) DataContractSerializer-名称不能以“。”开头 字符,十六进制值0x2E - DataContractSerializer - Name cannot begin with the '.' character, hexadecimal value 0x2E
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM