久久久久久久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 命名空間的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

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

                  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() 構(gòu)造聲明它們,并且需要在 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 屬性..... 所以當(dāng)然你沒有得到任何值!

                  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 命名空間 - 產(chǎn)生以下輸出:

                  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.

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

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

                  相關(guān)文檔推薦

                  SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產(chǎn)品、類別和元數(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ù)類型轉(zhuǎn)換錯誤?使用 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电影在线播放 | av无遮挡| 亚洲激情综合 | 久久99精品久久久久子伦 | 国产精品成人久久久久a级 久久蜜桃av一区二区天堂 | 国产精品91视频 | 男人的天堂在线视频 | 亚洲一二三在线观看 | 韩日精品在线观看 | 国产精品久久久久久久久久久新郎 | 91porn成人精品 | 免费能直接在线观看黄的视频 | 密色视频 | 亚洲成人一区二区三区 | 天天干天天操天天射 | 91九色在线观看 | 久久久久久久久久久国产 | 亚洲色图50p | 久久精品 | 欧美日一区二区 | 午夜影院在线观看视频 | 亚洲人成在线播放 | 亚洲日日夜夜 | 久久精品亚洲精品国产欧美kt∨ | 日本高清不卡视频 | 国产精品视频中文字幕 | 91网站在线看| 欧美日韩高清在线观看 | 一区二区视频在线 | 夜夜爽99久久国产综合精品女不卡 | 久久av网| 黄色av免费 | 日韩精品在线免费观看视频 |