相关疑难解决方法(0)

XElement命名空间(如何?)

如何使用节点前缀创建xml文档,如:

<sphinx:docset>
  <sphinx:schema>
    <sphinx:field name="subject"/>
    <sphinx:field name="content"/>
    <sphinx:attr name="published" type="timestamp"/>
 </sphinx:schema>
Run Code Online (Sandbox Code Playgroud)

当我尝试运行像new XElement("sphinx:docset")我得到异常的东西时

未处理的异常:System.Xml.XmlException:':'字符,十六进制值0x3A,不能包含在名称中.
在System.Xml.XmlConvert.VerifyNCName(String name,ExceptionType exceptionTyp e)
处System.Xml.Linq.XName..ctor(XNamespace ns,String localName)
处于System.Xml.Linq.XNamespace.GetName(String localName)
at System .Xml.Linq.XName.Get(String expandedName)

c# xml linq namespaces

70
推荐指数
2
解决办法
6万
查看次数

标签 统计

c# ×1

linq ×1

namespaces ×1

xml ×1