如何使用節點前綴創建XML文檔,如:的XElement命名空間(如何?)
<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:名稱中不能包含':'字符,十六進制數字爲0x3A。 at System.Xml.XmlConvert.VerifyNCName(String name,ExceptionType exceptionTyp e) at System.Xml.Linq.XName..ctor(XNamespace ns,String localName) at System.Xml.Linq.XNamespace.GetName(String的localName) 在System.Xml.Linq.XName.Get(字符串expandedName)
謝謝大家幫忙!;)
查看`XmlNamespaceManager`類。 – 2011-02-13 18:29:59
您的文件將無效。它需要聲明`sphinx`前綴。 – 2011-02-13 18:54:04