pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<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="s2cm2se" 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="eai2sgm" 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="g0i0im2" 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>

                            主站蜘蛛池模板: 合肥触摸一体机_触摸查询机厂家_合肥拼接屏-安徽迅博智能科技 | 高考志愿规划师_高考规划师_高考培训师_高报师_升学规划师_高考志愿规划师培训认证机构「向阳生涯」 | 广州食堂承包_广州团餐配送_广州堂食餐饮服务公司 - 旺记餐饮 | 干粉砂浆设备-干粉砂浆生产线-干混-石膏-保温砂浆设备生产线-腻子粉设备厂家-国恒机械 | 涂层测厚仪_光泽度仪_uv能量计_紫外辐照计_太阳膜测试仪_透光率仪-林上科技 | 防腐储罐_塑料储罐_PE储罐厂家_淄博富邦滚塑防腐设备科技有限公司 | 安德建奇火花机-阿奇夏米尔慢走丝|高维|发那科-北京杰森柏汇 | 胀套-锁紧盘-风电锁紧盘-蛇形联轴器「厂家」-瑞安市宝德隆机械配件有限公司 | 培训无忧网-教育培训咨询招生第三方平台 | 济南电缆桥架|山东桥架-济南航丰实业有限公司| 氢氧化钙设备, 氢氧化钙生产线-淄博惠琛工贸有限公司 | GAST/BRIWATEC/CINCINNATI/KARL-KLEIN/ZIEHL-ABEGG风机|亚喜科技 | 洛阳装修公司-洛阳整装一站式品牌-福尚云宅装饰 | 低气压试验箱_高低温低气压试验箱_低气压实验箱 |林频试验设备品牌 | 光伏支架成型设备-光伏钢边框设备-光伏设备厂家 | 泵阀展|阀门展|水泵展|流体机械展 -2025上海国际泵管阀展览会flowtech china | AGV无人叉车_激光叉车AGV_仓储AGV小车_AGV无人搬运车-南昌IKV机器人有限公司[官网] | 水厂污泥地磅|污泥处理地磅厂家|地磅无人值守称重系统升级改造|地磅自动称重系统维修-河南成辉电子科技有限公司 | 大型低温冷却液循环泵-低温水槽冷阱「厂家品牌」京华仪器_京华仪器 | 电子海图系统-电梯检验系统-智慧供热系统开发-商品房预售资金监管系统 | 筛分机|振动筛分机|气流筛分机|筛分机厂家-新乡市大汉振动机械有限公司 | 不锈钢散热器,冷却翅片管散热器厂家-无锡市烨晟化工装备科技有限公司 | 天津云仓-天津仓储物流-天津云仓一件代发-顺东云仓 | 呼末二氧化碳|ETCO2模块采样管_气体干燥管_气体过滤器-湖南纳雄医疗器械有限公司 | 空调风机,低噪声离心式通风机,不锈钢防爆风机,前倾皮带传动风机,后倾空调风机-山东捷风风机有限公司 | 消泡剂_水处理消泡剂_切削液消泡剂_涂料消泡剂_有机硅消泡剂_广州中万新材料生产厂家 | 芝麻黑-芝麻黑石材厂家-永峰石业 | 德国UST优斯特氢气检漏仪-德国舒赐乙烷检测仪-北京泽钏 | 对夹式止回阀_对夹式蝶形止回阀_对夹式软密封止回阀_超薄型止回阀_不锈钢底阀-温州上炬阀门科技有限公司 | 高压贴片电容|贴片安规电容|三端滤波器|风华电容代理南京南山 | 浙江富广阀门有限公司| 济南ISO9000认证咨询代理公司,ISO9001认证,CMA实验室认证,ISO/TS16949认证,服务体系认证,资产管理体系认证,SC食品生产许可证- 济南创远企业管理咨询有限公司 郑州电线电缆厂家-防火|低压|低烟无卤电缆-河南明星电缆 | 基业箱_环网柜_配电柜厂家_开关柜厂家_开关断路器-东莞基业电气设备有限公司 | 吸污车_吸粪车_抽粪车_电动三轮吸粪车_真空吸污车_高压清洗吸污车-远大汽车制造有限公司 | 爆炸冲击传感器-无线遥测传感器-航天星百科 | 成都网站建设制作_高端网站设计公司「做网站送优化推广」 | 济南保安公司加盟挂靠-亮剑国际安保服务集团总部-山东保安公司|济南保安培训学校 | 吸污车_吸粪车_抽粪车_电动三轮吸粪车_真空吸污车_高压清洗吸污车-远大汽车制造有限公司 | 魔方网-培训咨询服务平台| 小区健身器材_户外健身器材_室外健身器材_公园健身路径-沧州浩然体育器材有限公司 | 北京网站建设-企业网站建设-建站公司-做网站-北京良言多米网络公司 |