在我的web應用程序中,我使用xsd文件作爲嵌入式資源來驗證xml文檔,使用assembly.GetManifestResourceStream(string)
很容易。如何在嵌入式xsd中使用include引用另一個嵌入式xsd?
我現在需要使用include
元素(其實我需要redefine
,但我得到的錯誤是一樣的,所以我擴大問題的範圍)內我的xsd的一個引用另一個嵌入的XSD,還等什麼我所做的是:
以下行添加到項目的AssemblyInfo.cs中
[assembly: System.Web.UI.WebResource("TurniArc.xml.schema.ImportOperatoriParametri.xsd", "text/xml", PerformSubstitution = true)]
[assembly: System.Web.UI.WebResource("TurniArc.xml.schema.ProcessiInput.xsd", "text/xml", PerformSubstitution = true)]
修飾的「ImportOperatoriParametri.xsd」內的「包含」的元素插入此:
<xs:include schemaLocation="<% = WebResource("TurniArc.xml.schema.ProcessiInput.xsd") %>">
這種技術工作時,我不得不從嵌入式CSS參考的嵌入圖像。可悲的是,這裏沒有,因爲GetManifestResourceStream方法拋出異常
'<', hexadecimal value 0x3C, is an invalid attribute character. Line 3, position 34.
這似乎是「PerformSubstition」屬性還沒有設置,因爲它試圖讀取的schemaLocation的屬性爲「正規」的字符串。
我在做什麼錯?謝謝
+1非常有用,也是重要的問題。 – 2011-03-07 00:03:55