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

<tfoot id='dbZTt'></tfoot>

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

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

        如何在 SQL Server 的 XQuery 中獲取特定的 XML 命名空

        How to get specific XML namespace in XQuery in SQL Server(如何在 SQL Server 的 XQuery 中獲取特定的 XML 命名空間)

            <tbody id='tUtad'></tbody>
            <tfoot id='tUtad'></tfoot>
              • <bdo id='tUtad'></bdo><ul id='tUtad'></ul>

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

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

                  本文介紹了如何在 SQL Server 的 XQuery 中獲取特定的 XML 命名空間的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有一個 XML,我需要一個特定的命名空間,根據節點(如帶有 hls 的 temprature),我需要該http://www.schema.hls.com/extension"我已經嘗試過這些

                  I have a XML that I need one specific namespace according to node like temprature with hls i need namespace of that "http://www.schema.hls.com/extension" I have tried with these

                  DECLARE @EventXML AS XML
                  
                  SET @EventXML='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                  <ns:test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:ns="urn:global:test:xsd:1" 
                  xmlns:hls="http://schema.hls.com/extension" creationDate="2007-01-25T00:00:00Z"
                  schemaVersion="1.0">
                  <TestBody>
                  <TestList>
                  <TestEvent>
                      <hls:temperature>20</hls:temperature>
                    </TestEvent>
                  </TestList>
                  </TestBody>
                  </ns:test>'
                  
                  SELECT 
                  OE.value('@ns','varchar(50)') + '#' + OE.value('fn:local-name(.)[1]','varchar(50)'),
                  OE.value('@id','varchar(50)'),
                  CONVERT(VARCHAR(4000),CASE WHEN OE.exist('./*') =1 THEN OE.query('./*')  ELSE    
                  OE.value('./text()[1]','varchar(100)') END)
                  FROM @EventXML.nodes('//TestEvent/*') TestEvent(OE)
                  WHERE OE.value('fn:local-name(.)[1]','varchar(50)') IN --(@tag) 
                  (SELECT  Split.a.value('.', 'VARCHAR(100)') AS extag 
                  FROM  (SELECT   CONVERT(XML,'<M>' + REPLACE(ISNULL('temperature','0'), ',', '</M><M>') + '</M>') AS String 
                   ) AS A CROSS APPLY String.nodes ('/M') AS Split(a))  
                  

                  我在 SQL 查詢窗口中使用這些,但只獲得第三列值 20 沒有通過@ns 獲得命名空間

                  I am using these in SQL query window but getting only third column value 20 not get namespace by @ns

                  請建議如何獲取命名空間

                  Please suggest how to get the namespace

                  OE.value('@ns','varchar(50)') 
                  

                  通過這些.

                  提前致謝.

                  推薦答案

                  不知何故,您的代碼和 XML 不太匹配 - 并且查詢真的很混亂....

                  Your code and XML somehow just don't quite match up - and the query is really quite confusing....

                  如果您想獲取數據,您必須尊重正在使用的 XML 命名空間.您需要使用 WITH XMLNAMESPACES() 構造聲明它們,并且需要在 XPath 中使用它們.

                  If you want to fetch the data, you must respect the XML namespaces in play. You need to declare them with a WITH XMLNAMESPACES() construct, and you need to use them in your XPath.

                  而且:您選擇的節點()實際上沒有任何idns 屬性..... 所以當然你沒有得到任何值!

                  But also: the node you're selecting (<hls:temperature>) doesn't really have any id and ns attributes..... so of course you're not getting any values!

                  我嘗試使用精簡版并添加了兩個屬性 - 只是為了展示如何在代碼中使用 XML 命名空間.

                  I tried to use a trimmed down version and I added the two attributes - just to show how to use the XML namespaces stuff in your code.

                  來了:

                  DECLARE @EventXML AS XML
                  
                  SET @EventXML = 
                     '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                      <ns:test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                               xmlns:ns="urn:global:test:xsd:1" 
                               xmlns:hls="http://schema.hls.com/extension" 
                               creationDate="2007-01-25T00:00:00Z" schemaVersion="1.0">
                         <TestBody>
                            <TestList>
                               <TestEvent>
                                  <hls:temperature ns="test" id="42">20</hls:temperature>
                               </TestEvent>
                           </TestList>
                        </TestBody>
                     </ns:test>'
                  
                  -- define your XML namespaces that are in play. 
                  -- You *MUST* match the namespace definition, but the *prefixes* that you define
                  -- can be something else entirely than in the XML document!
                  -- Of course, inside your XPath, you *MUST* use the defined prefixes!
                  ;WITH XMLNAMESPACES('urn:global:test:xsd:1' AS x1, 
                                      'http://schema.hls.com/extension' AS x2)
                  SELECT 
                      OE.value('@ns', 'varchar(50)'),
                      OE.value('@id', 'varchar(50)')
                  FROM 
                      @EventXML.nodes('/x1:test/TestBody/TestList/TestEvent/x2:*') TestEvent(OE)
                  

                  此代碼 - 使用在您的 XML 中定義和使用的 XML 命名空間 - 產生以下輸出:

                  This code - using the XML namespaces defined and used in your XML - produces this output:

                  (No column name)  (No column name)
                  test                   42
                  

                  所以這顯示了如何訪問屬性 - 如果它們存在!- 在您的 XML 節點上,即使存在 XML 命名空間.

                  So this shows how you can access the attributes - if they are present! - on your XML nodes, even with the presence of XML namespaces.

                  這篇關于如何在 SQL Server 的 XQuery 中獲取特定的 XML 命名空間的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產品、類別和元數據的 SQL 查詢 woocommerce/wordpress)
                  Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數據庫列表和 SQL Server 實例使用的空間嗎?) - IT屋-程序員軟件開發
                  How to create a login to a SQL Server instance?(如何創建對 SQL Server 實例的登錄?)
                  How to know the version and edition of SQL Server through registry search(如何通過注冊表搜索知道SQL Server的版本和版本)
                  Why do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(為什么會出現“數據類型轉換錯誤?使用 ExecuteNonQuery()?)
                  How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)
                  <legend id='DXLa4'><style id='DXLa4'><dir id='DXLa4'><q id='DXLa4'></q></dir></style></legend>

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

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

                      <tbody id='DXLa4'></tbody>
                      • <bdo id='DXLa4'></bdo><ul id='DXLa4'></ul>

                            主站蜘蛛池模板: 九九在线视频 | 手机av在线 | 欧美在线日韩 | 中文字幕电影在线观看 | 国产精品久久久久久婷婷天堂 | 亚洲 中文 欧美 | 日韩一区二区三区在线 | 久久久久久亚洲精品 | 亚洲成人综合网站 | 亚洲精品一区二区三区 | 欧美成人a∨高清免费观看 老司机午夜性大片 | 国产亚洲成av人在线观看导航 | 91精品国产综合久久久动漫日韩 | 羞羞视频一区二区 | 最新中文字幕 | 精品欧美一区二区在线观看欧美熟 | 成人一区二区三区在线观看 | 毛片一级片 | 性欧美hd | 国产在线不卡 | 国产一区二区av | 国产91丝袜在线18 | 亚洲精品在 | 中文字幕加勒比 | 国产高清在线观看 | 成人在线一区二区三区 | 久久国产高清 | 一本一道久久a久久精品综合蜜臀 | 亚洲色图图片 | 亚洲一区在线播放 | 91欧美 | 亚洲一区国产精品 | 亚洲在线日韩 | 国产999精品久久久久久绿帽 | 久久青| 99综合| 欧美在线视频a | 日韩精品一区在线观看 | 国产露脸对白88av | 2018中文字幕第一页 | 久久6视频 |