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

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

          <bdo id='sEwiF'></bdo><ul id='sEwiF'></ul>

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

        使用 Xquery 檢索 xml 屬性

        Retrieving xml attribute using Xquery(使用 Xquery 檢索 xml 屬性)
          <tbody id='SsGTQ'></tbody>
      1. <i id='SsGTQ'><tr id='SsGTQ'><dt id='SsGTQ'><q id='SsGTQ'><span id='SsGTQ'><b id='SsGTQ'><form id='SsGTQ'><ins id='SsGTQ'></ins><ul id='SsGTQ'></ul><sub id='SsGTQ'></sub></form><legend id='SsGTQ'></legend><bdo id='SsGTQ'><pre id='SsGTQ'><center id='SsGTQ'></center></pre></bdo></b><th id='SsGTQ'></th></span></q></dt></tr></i><div class="ddjttf8" id='SsGTQ'><tfoot id='SsGTQ'></tfoot><dl id='SsGTQ'><fieldset id='SsGTQ'></fieldset></dl></div>

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

          <tfoot id='SsGTQ'></tfoot>

          • <legend id='SsGTQ'><style id='SsGTQ'><dir id='SsGTQ'><q id='SsGTQ'></q></dir></style></legend>

                  <bdo id='SsGTQ'></bdo><ul id='SsGTQ'></ul>

                • 本文介紹了使用 Xquery 檢索 xml 屬性的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我使用以下查詢從 XML 文件的屬性 ad 元素中選擇 XML 的值,但我無法從 XML 頁面讀取 seq、id、reported dated 屬性所以任何人請建議如何使用此查詢獲取屬性值.

                  I am using the below query to select the values of XML from attributes ad elements of the XML file but I am not able to read the seq, id, reported dated attributes from XML page so any one please suggest How to get values of attributes using this Query.

                  select a_node.value('(./text())[1]', 'var char(50)') AS c_val,
                  c1_node.value('(./text())[1]', 'var char(50)') AS c_val 2,
                  ca_node.value('(./text())[1]', 'var char(50)') AS c_val3, 
                  d_node.value('(./text())[1]', 'var char(50)') ,
                  e_node.value('(./text())[1]', 'varchar(50)') ,
                  f_node.value('(./text())[1]', 'var char(50)') 
                  FROM @xmlData.nodes('/Reports/x:InquiryResponse/x:ReportData/x:AccountDetails/x:Account') AS b(b_node) 
                  outer APPLY b.b_node.nodes('./x:primarykey') AS pK_InquiryResponse (a_node) 
                  outer APPLY b.b_node.nodes('./x:seq') AS CustomerCode (c1_node) 
                  outer APPLY b.b_node.nodes('./x:id') AS amount (ca_node)
                  outer APPLY b.b_node.nodes('./x:ReportedDate') AS CustRefField (d_node)
                  outer APPLY b.b_node.nodes('./x:AccountNumber') AS ReportOrderNO (e_node)
                  outer apply b.b_node.nodes('./x:CurrentBalance') as additional_id (f_node);
                  

                  編輯:評論中提供的 Xml 片段

                  Edit: Xml Snippets Provided in Comments

                  <sch:Account seq="2" id="345778174" ReportedDate="2014-01-01">
                      <sch:AccountNumber>TSTC1595</sch:AccountNumber>
                      <sch:CurrentBalance>0</sch:CurrentBalance>
                      <sch:Institution>Muthoot Fincorp Limited</sch:Institution>
                      <sch:PastDueAmount>0</sch:PastDueAmount>
                      <sch:DisbursedAmount>12000</sch:DisbursedAmount>
                      <sch:LoanCategory>JOG Group</sch:LoanCategory>
                  </sch:Account>
                  
                  <sch:Account seq="2" id="345778174" ReportedDate="2014-01-01">
                      <sch:BranchIDMFI>THRISSUR ROAD</sch:BranchIDMFI>
                      <sch:KendraIDMFI>COSTCO/RECENT-107</sch:KendraIDMFI>
                  </sch:Account>
                  

                  推薦答案

                  使用 Xml Loose @Variable 解析 XQuery

                  假設有一個與此類似的 Xml 文檔(即具有一個元素上的所有屬性):

                  Assuming an Xml document similar to this (viz with all the attributes on one element):

                  DECLARE @xmlData XML = 
                  N'<Reports xmlns:x="http://foo">
                      <x:InquiryResponse>
                          <x:ReportData>
                              <x:AccountDetails>
                                  <x:Account x:primarykey="pk" x:seq="sq" x:id="id"
                                               x:ReportedDate="2014-01-01T00:00:00" />
                              </x:AccountDetails>
                          </x:ReportData>
                      </x:InquiryResponse>
                  </Reports>';
                  

                  您可以按如下方式抓取屬性:

                  You can scrape the attributes out as follows:

                  WITH XMLNAMESPACES('http://foo' AS x)
                  select 
                      Nodes.node.value('(@x:primarykey)[1]', 'varchar(50)') AS c_val,
                      Nodes.node.value('(@x:seq)[1]', 'varchar(50)') AS c_val2,
                      Nodes.node.value('(@x:id)[1]', 'varchar(50)') AS c_val3, 
                      Nodes.node.value('(@x:ReportedDate)[1]', 'DATETIME') as someDateTime
                  FROM 
                     @xmlData.nodes('/Reports/x:InquiryResponse/x:ReportData/x:AccountDetails/x:Account') 
                     AS Nodes(node);
                  

                  • 屬性不需要 text() 因為它們自動是字符串
                  • 在命名空間中具有屬性是相當不尋常的 - 如果沒有,請刪除 xmlns 別名前綴.
                    • Attributes don't need text() as they are automatically strings
                    • It is fairly unusual to have attributes in a namespace - drop the xmlns alias prefix if they aren't.
                    • 此處為 SqlFiddle

                      編輯 - 解析 Xml 列

                      • 從屬性中刪除的命名空間- 假設你有一個表中的數據,而不是一個變量,因此 APPLY 要求.請注意, OUTER APPLY 將返回空值,例如僅當您有行時有用空 Xml 或缺少 Xml 元素.CROSS APPLY 是常態(即將 xpath 應用于 LHS 表上選定的每一行)
                      • 元素的訪問方式類似于屬性,只是沒有@
                      • Namespace dropped from the attributes -Assumed that you have the data in a table, not a variable, hence the APPLY requirement. Note that OUTER APPLY will return nulls, e.g. useful only if you have rows with empty Xml or missing Xml Elements. CROSS APPLY is the norm (viz applying the xpath to each row selected on the LHS table)
                      • Elements are accessed similar to attributes, just without @


                      WITH XMLNAMESPACES('http://foo' AS x)
                      select 
                          Nodes.node.value('(@seq)[1]', 'varchar(50)') AS c_val2,
                          Nodes.node.value('(@id)[1]', 'varchar(50)') AS c_val3, 
                          Nodes.node.value('(@ReportedDate)[1]', 'DATETIME') as someDateTime,
                          Nodes.node.value('(x:AccountNumber)[1]', 'VARCHAR(50)') as accountNumber
                      FROM 
                          MyXmlData z
                          CROSS APPLY
                      z.XmlColumn.nodes('/Reports/x:InquiryResponse/x:ReportData/x:AccountDetails/x:Account') 
                            AS Nodes(node);
                      

                      更新小提琴

                      從磁盤編輯 Xml 文件

                      這是從磁盤讀取的 xml 文件的相同內容.請注意,一旦您在 XML 變量 (@MyXmlData) 中擁有數據,您就不需要 CROSS APPLY 到任何東西 - 只需提供xpath 選擇合適的節點,然后刮取元素和屬性.

                      Here's the same thing for an xml file read from disk. Note that once you have the data in an XML variable (@MyXmlData) that you don't need to CROSS APPLY to anything - just supply xpath to select the appropriate node, and then scrape out the elements and attributes.

                      DECLARE @MyXmlData XML;
                      SET @MyXmlData = 
                      ( SELECT * FROM OPENROWSET ( BULK N'c:\temp\file3098.xml', SINGLE_CLOB ) AS MyXmlData );
                      -- Assuming all on the one element, no need for all the applies
                      -- attributes don't have a text axis (they are automatically strings
                      
                      WITH XMLNAMESPACES('http://foo' AS x)
                      select 
                          Nodes.node.value('(@seq)[1]', 'varchar(50)') AS c_val2,
                          Nodes.node.value('(@id)[1]', 'varchar(50)') AS c_val3, 
                          Nodes.node.value('(@ReportedDate)[1]', 'DATETIME') as someDateTime,
                          Nodes.node.value('(x:AccountNumber)[1]', 'VARCHAR(50)') as accountNumber
                      FROM 
                            @MyXmlData.nodes('/Reports/x:InquiryResponse/x:ReportData/x:AccountDetails/x:Account') 
                            AS Nodes(node);
                      

                      這篇關于使用 Xquery 檢索 xml 屬性的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  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?)
                  WinForms application design - moving documents from SQL Server to file storage(WinForms 應用程序設計——將文檔從 SQL Server 移動到文件存儲)

                    <bdo id='O0Z2E'></bdo><ul id='O0Z2E'></ul>
                    • <small id='O0Z2E'></small><noframes id='O0Z2E'>

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

                      • <tfoot id='O0Z2E'></tfoot>
                          <tbody id='O0Z2E'></tbody>

                        <legend id='O0Z2E'><style id='O0Z2E'><dir id='O0Z2E'><q id='O0Z2E'></q></dir></style></legend>

                          1. 主站蜘蛛池模板: 咖啡加盟,咖啡店加盟连锁品牌-卡小逗 | 99文库_实习生实用的范文资料文库站| 四川成人高考_四川成考报名网| 米顿罗计量泵(科普)——韬铭机械| 齿轮减速马达一体式_蜗轮蜗杆减速机配电机-德国BOSERL齿轮减速电动机生产厂家 | 佛山市钱丰金属不锈钢蜂窝板定制厂家|不锈钢装饰线条|不锈钢屏风| 电梯装饰板|不锈钢蜂窝板不锈钢工艺板材厂家佛山市钱丰金属制品有限公司 | 数控专用机床,专用机床,自动线,组合机床,动力头,自动化加工生产线,江苏海鑫机床有限公司 | 捷码低代码平台 - 3D数字孪生_大数据可视化开发平台「免费体验」 | 碳纤维复合材料制品生产定制工厂订制厂家-凯夫拉凯芙拉碳纤维手机壳套-碳纤维雪茄盒外壳套-深圳市润大世纪新材料科技有限公司 | 送料机_高速冲床送料机_NC伺服滚轮送料机厂家-东莞市久谐自动化设备有限公司 | 合肥白癜风医院_[治疗白癜风]哪家好_合肥北大白癜风医院 | 超高频感应加热设备_高频感应电源厂家_CCD视觉检测设备_振动盘视觉检测设备_深圳雨滴科技-深圳市雨滴科技有限公司 | 硅胶布|电磁炉垫片|特氟龙胶带-江苏浩天复合材料有限公司 | 冷凝水循环试验箱-冷凝水试验箱-可编程高低温试验箱厂家-上海巨为(www.juweigroup.com) | 智慧水务|智慧供排水利信息化|水厂软硬件系统-上海敢创 | 大型低温冷却液循环泵-低温水槽冷阱「厂家品牌」京华仪器_京华仪器 | 纯水电导率测定仪-万用气体检测仪-低钠测定仪-米沃奇科技(北京)有限公司www.milwaukeeinst.cn 锂辉石检测仪器,水泥成分快速分析仪-湘潭宇科分析仪器有限公司 手术室净化装修-手术室净化工程公司-华锐手术室净化厂家 | 无锡装修装潢公司,口碑好的装饰装修公司-无锡索美装饰设计工程有限公司 | 河南15年专业网站建设制作设计,做网站就找郑州启凡网络公司 | 直齿驱动-新型回转驱动和回转支承解决方案提供商-不二传动 | 自动化生产线-自动化装配线-直流电机自动化生产线-东莞市慧百自动化有限公司 | 不锈钢螺丝 - 六角螺丝厂家 - 不锈钢紧固件 - 万千紧固件--紧固件一站式采购 | 车件|铜件|车削件|车床加工|五金冲压件-PIN针,精密车件定制专业厂商【东莞品晔】 | 波纹补偿器_不锈钢波纹补偿器_巩义市润达管道设备制造有限公司 | 武汉刮刮奖_刮刮卡印刷厂_为企业提供门票印刷_武汉合格证印刷_现金劵代金券印刷制作 - 武汉泽雅印刷有限公司 | 办公室家具公司_办公家具品牌厂家_森拉堡办公家具【官网】 | 定时排水阀/排气阀-仪表三通旋塞阀-直角式脉冲电磁阀-永嘉良科阀门有限公司 | 水冷式工业冷水机组_风冷式工业冷水机_水冷螺杆冷冻机组-深圳市普威机械设备有限公司 | 欧美日韩国产一区二区三区不_久久久久国产精品无码不卡_亚洲欧洲美洲无码精品AV_精品一区美女视频_日韩黄色性爱一级视频_日本五十路人妻斩_国产99视频免费精品是看4_亚洲中文字幕无码一二三四区_国产小萍萍挤奶喷奶水_亚洲另类精品无码在线一区 | 睿婕轻钢别墅_钢结构别墅_厂家设计施工报价 | 密集架-手摇-智能-移动-价格_内蒙古档案密集架生产厂家 | 玻璃钢板-玻璃钢防腐瓦-玻璃钢材料-广东壹诺 | 北京银联移动POS机办理_收银POS机_智能pos机_刷卡机_收银系统_个人POS机-谷骐科技【官网】 | 四川职高信息网-初高中、大专、职业技术学校招生信息网 | 高精度电阻回路测试仪-回路直流电阻测试仪-武汉特高压电力科技有限公司 | 玻纤土工格栅_钢塑格栅_PP焊接_单双向塑料土工格栅_复合防裂布厂家_山东大庚工程材料科技有限公司 | 巩义市科瑞仪器有限公司| 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | 中央空调温控器_风机盘管温控器_智能_液晶_三速开关面板-中央空调温控器厂家 | 品牌广告服务平台,好排名,好流量,好生意。 | 微波萃取合成仪-电热消解器价格-北京安合美诚科学仪器有限公司 |