【发布时间】:2011-06-26 12:54:35
【问题描述】:
如何创建带有节点前缀的 xml 文档:
<sphinx:docset>
<sphinx:schema>
<sphinx:field name="subject"/>
<sphinx:field name="content"/>
<sphinx:attr name="published" type="timestamp"/>
</sphinx:schema>
当我尝试运行 new XElement("sphinx:docset") 之类的东西时,我遇到了异常
未处理的异常:System.Xml.XmlException:':' 字符,十六进制值 ue 0x3A,不能包含在名称中。
在 System.Xml.XmlConvert.VerifyNCName(字符串名称,ExceptionType exceptionTyp e)
在 System.Xml.Linq.XName..ctor(XNamespace ns, String localName)
在 System.Xml.Linq.XNamespace.GetName(String localName)
在 System.Xml.Linq.XName.Get(字符串扩展名称)
【问题讨论】:
-
查看
XmlNamespaceManager类。 -
您的文档无效。它需要声明
sphinx前缀。
标签: c# xml linq namespaces