久久久久久久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,我需要一個特定的命名空間,根據(jù)節(jié)點(如帶有 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....

                  如果您想獲取數(shù)據(jù),您必須尊重正在使用的 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.

                  而且:您選擇的節(jié)點()實際上沒有任何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 節(jié)點上,即使存在 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模板網!

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

                  相關文檔推薦

                  SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產品、類別和元數(shù)據(jù)的 SQL 查詢 woocommerce/wordpress)
                  Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數(shù)據(jù)庫列表和 SQL Server 實例使用的空間嗎?) - IT屋-程序員軟件開發(fā)
                  How to create a login to a SQL Server instance?(如何創(chuàng)建對 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()?(為什么會出現(xiàn)“數(shù)據(jù)類型轉換錯誤?使用 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>

                            主站蜘蛛池模板: 成人在线观看黄 | 一区二区三区视频免费看 | 欧美精品一区在线 | 国产高清亚洲 | 新91视频网| 精品欧美一区二区在线观看欧美熟 | 粉嫩高清一区二区三区 | 亚洲激精日韩激精欧美精品 | 9191成人精品久久 | www.亚洲一区二区三区 | 亚洲一区二区三区四区五区午夜 | 国产精品www | 人妖一区| 久久精品视频免费看 | 国产精品一区二区视频 | 视频一区在线观看 | 亚洲天堂av网 | 黄色大片在线视频 | 久久综合九色综合欧美狠狠 | av中文字幕在线观看 | 天天操天天干天天爽 | 亚洲电影第1页 | 亚洲天堂中文字幕 | 亚洲在线久久 | 日韩成人影院在线观看 | av资源网站| 欧美一区二区三区在线视频 | h片免费在线观看 | 欧美专区在线 | 中文字幕专区 | 九九久久免费视频 | 久久aⅴ乱码一区二区三区 91综合网 | 在线免费观看成年人视频 | 丝袜一区二区三区 | 久久久婷婷 | 中文字幕一区在线观看视频 | 国内av在线 | 久久精品国产99国产精品 | 91久久国产综合久久 | 国产一区二区三区在线 | 99久久久久国产精品免费 |