久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='eACbU'></small><noframes id='eACbU'>

  • <i id='eACbU'><tr id='eACbU'><dt id='eACbU'><q id='eACbU'><span id='eACbU'><b id='eACbU'><form id='eACbU'><ins id='eACbU'></ins><ul id='eACbU'></ul><sub id='eACbU'></sub></form><legend id='eACbU'></legend><bdo id='eACbU'><pre id='eACbU'><center id='eACbU'></center></pre></bdo></b><th id='eACbU'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eACbU'><tfoot id='eACbU'></tfoot><dl id='eACbU'><fieldset id='eACbU'></fieldset></dl></div>
      <bdo id='eACbU'></bdo><ul id='eACbU'></ul>
    <tfoot id='eACbU'></tfoot>
  • <legend id='eACbU'><style id='eACbU'><dir id='eACbU'><q id='eACbU'></q></dir></style></legend>

        將(嵌入式資源)架構添加到 XmlReaderSettings 而不是

        Adding (Embedded Resource) Schema To XmlReaderSettings Instead Of Filename?(將(嵌入式資源)架構添加到 XmlReaderSettings 而不是文件名?)
      1. <i id='dutyr'><tr id='dutyr'><dt id='dutyr'><q id='dutyr'><span id='dutyr'><b id='dutyr'><form id='dutyr'><ins id='dutyr'></ins><ul id='dutyr'></ul><sub id='dutyr'></sub></form><legend id='dutyr'></legend><bdo id='dutyr'><pre id='dutyr'><center id='dutyr'></center></pre></bdo></b><th id='dutyr'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dutyr'><tfoot id='dutyr'></tfoot><dl id='dutyr'><fieldset id='dutyr'></fieldset></dl></div>

      2. <legend id='dutyr'><style id='dutyr'><dir id='dutyr'><q id='dutyr'></q></dir></style></legend>
        <tfoot id='dutyr'></tfoot>
          • <small id='dutyr'></small><noframes id='dutyr'>

              <bdo id='dutyr'></bdo><ul id='dutyr'></ul>
                  <tbody id='dutyr'></tbody>

                  本文介紹了將(嵌入式資源)架構添加到 XmlReaderSettings 而不是文件名?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我正在編寫一個解析 Xml 文件的應用程序.我有架構 (.xsd) 文件,用于在嘗試反序列化之前驗證 Xml:

                  I am writing an application that parses an Xml file. I have the schema (.xsd) file which I use to validate the Xml before trying to deserialize it:

                  XmlReaderSettings settings = new XmlReaderSettings();
                  settings.Schemas.Add(null, "./xml/schemas/myschema.xsd");
                  settings.ValidationType = ValidationType.Schema;
                  XmlReader reader = XmlReader.Create(xmlFile, settings);
                  XmlDocument document = new XmlDocument();
                  document.Load(reader);
                  ValidationEventHandler eventHandler = new ValidationEventHandler(settings_ValidationEventHandler);
                  document.Validate(eventHandler);
                  

                  請注意,參數 *./xml/schemas/myschema.xsd" 是 .xsd 相對于程序執行的路徑.

                  Note that the parameter *./xml/schemas/myschema.xsd" is the path to the .xsd relative to program execution.

                  我不想使用文件名/路徑,而是將 .xsd 文件編譯為我的項目中的嵌入式資源(我已經添加了 .xsd 文件并將構建操作設置為嵌入式資源).

                  I don't want to use filenames/paths, instead I would rather compile the .xsd file as an embedded resource in my project (I have already added the .xsd file and set the Build Action to Embedded Resource).

                  我的問題是....如何將嵌入式資源架構添加到 XmlReaderSettings 架構列表?settings.Schemas.Add 有 4 個重載方法,但沒有一個將嵌入資源作為參數.它們都采用架構文件的路徑.

                  My question is.... how do I add the Embedded Resource schema to the XmlReaderSettings schema list? There are 4 overloaded methods for settings.Schemas.Add but none of them take an embedded resource as an argument. They all take the path to the schema file.

                  我過去使用嵌入式資源來動態設置標簽圖像,因此我對使用嵌入式資源有些熟悉.查看我的其他代碼,看起來我最終得到的是一個包含內容的 Stream:

                  I have used embedded resources in the past for dynamically setting label images so I am somewhat familiar with using embedded resources. Looking at my other code it looks like what I eventually end up with is a Stream that contains the content:

                  System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
                  Stream myStream = myAssembly.GetManifestResourceStream(resourceName);
                  

                  我假設嵌入的 .xsd 也將作為流讀入,所以這稍微縮小了我的問題.當我引用包含架構而不是文件名的流時,如何將架構添加到 XmlReaderSettings?

                  I am assuming that the embedded .xsd will also be read in as a stream so this narrows down my question a bit. How do I add the schema to XmlReaderSettings when I have a reference to the stream containing the schema and not the filename?

                  推薦答案

                  您可以使用 Add() 重載,該重載將 XmlReader 作為其第二個參數:

                  You can use the Add() overload that takes an XmlReader as its second parameter:

                  Assembly myAssembly = Assembly.GetExecutingAssembly();
                  using (Stream schemaStream = myAssembly.GetManifestResourceStream(resourceName)) {
                    using (XmlReader schemaReader = XmlReader.Create(schemaStream)) {
                      settings.Schemas.Add(null, schemaReader);
                    }
                  }
                  

                  或者您可以先加載架構,然后添加它:

                  Or you can load the schema first and then add it:

                  Assembly myAssembly = Assembly.GetExecutingAssembly();
                  using (Stream schemaStream = myAssembly.GetManifestResourceStream(resourceName)) {
                    XmlSchema schema = XmlSchema.Read(schemaStream, null);
                    settings.Schemas.Add(schema);
                  }
                  

                  這篇關于將(嵌入式資源)架構添加到 XmlReaderSettings 而不是文件名?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  What are good algorithms for vehicle license plate detection?(車牌檢測有哪些好的算法?)
                  onClick event for Image in Unity(Unity中圖像的onClick事件)
                  Running Total C#(運行總 C#)
                  Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時刪除目錄)
                  asp.net listview highlight row on click(asp.net listview 在單擊時突出顯示行)
                  Calling A Button OnClick from a function(從函數調用按鈕 OnClick)

                1. <i id='jmy2Q'><tr id='jmy2Q'><dt id='jmy2Q'><q id='jmy2Q'><span id='jmy2Q'><b id='jmy2Q'><form id='jmy2Q'><ins id='jmy2Q'></ins><ul id='jmy2Q'></ul><sub id='jmy2Q'></sub></form><legend id='jmy2Q'></legend><bdo id='jmy2Q'><pre id='jmy2Q'><center id='jmy2Q'></center></pre></bdo></b><th id='jmy2Q'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='jmy2Q'><tfoot id='jmy2Q'></tfoot><dl id='jmy2Q'><fieldset id='jmy2Q'></fieldset></dl></div>

                2. <small id='jmy2Q'></small><noframes id='jmy2Q'>

                    <tbody id='jmy2Q'></tbody>

                      <legend id='jmy2Q'><style id='jmy2Q'><dir id='jmy2Q'><q id='jmy2Q'></q></dir></style></legend>
                        <bdo id='jmy2Q'></bdo><ul id='jmy2Q'></ul>
                        <tfoot id='jmy2Q'></tfoot>
                            主站蜘蛛池模板: 国产精品久久久久久妇女6080 | 成人在线免费观看 | 久久久新视频 | 日韩成人在线视频 | 国产综合久久 | 欧美日本久久 | 91传媒在线观看 | 国产人免费人成免费视频 | 亚洲一区二区久久 | 久久久久国产精品www | 人人干人人干人人 | 欧美国产日韩在线观看成人 | 日韩在线视频一区二区三区 | 午夜亚洲| 久久在线看 | 一区二区三区在线免费观看视频 | 麻豆av在线免费观看 | 欧美videosex性极品hd | 国产精品大片 | 日韩在线播放第一页 | 欧美精品久久久久 | 婷婷五月色综合香五月 | 欧洲一区二区三区 | 国产二区三区 | 在线看黄免费 | 国产精品99久久久久久www | 国精产品一品二品国精在线观看 | 日本精品视频一区二区 | 精品啪啪 | 日韩精品二区 | av网站在线看 | 国产精品视频一区二区三区 | 色毛片| 有码在线 | 国产精品久久久久久久久久久免费看 | 九九热这里只有精品6 | 欧美一区久久 | 日韩一区二区免费视频 | 97久久久久久 | 亚洲欧美一区二区三区在线 | 中文字幕亚洲视频 |