久久久久久久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>
                            主站蜘蛛池模板: 亚洲激情专区 | 日本小电影网站 | 亚洲日本视频 | 午夜影院污 | 无吗视频 | 国产一区二区三区久久久久久久久 | 91在线精品一区二区 | 国产精品国产成人国产三级 | 一区二区三区在线免费观看 | 国产乱码精品一区二区三区忘忧草 | av日韩在线播放 | 亚洲一区二区在线视频 | 7777精品伊人久久精品影视 | 午夜电影福利 | 三区四区在线观看 | 国产成人免费 | 亚洲精品一区二区三区中文字幕 | 国产精品极品美女在线观看免费 | 欧美乱做爰xxxⅹ久久久 | 精品综合久久久 | 亚洲精品二三区 | 亚洲欧美日韩一区 | 一区二区三区四区电影视频在线观看 | 一级做a爰片久久毛片免费看 | 三级欧美 | 五月婷婷婷 | 亚洲免费在线播放 | 久久99国产精一区二区三区 | 日韩欧美在 | www.99精品| 黄色网址免费在线观看 | 九九精品影院 | 亚洲成人蜜桃 | 在线播放中文 | 亚洲乱码一区二区三区在线观看 | 欧美性久久 | 久草欧美视频 | 久久99精品久久久水蜜桃 | 亚洲成av人片在线观看无码 | 日韩一区二区三区视频 | 精品国产99 |