使用OPENXML()提取XML [英] Extract XML using OPENXML()
本文介绍了使用OPENXML()提取XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题是我不知道如何使用OpenXML提取XML标签元素.任何澄清都很好.
My problem is that I do not know how to extract the XML tag element using OpenXML. Any clarification would be great.
我以前使用过xml.node,但是现在我正在过渡到OpenXML
I have using xml.node before but now I am transitioning to OpenXML
我的XML文档可以在此处找到
我的存储过程:
ALTER procedure [dbo].[WEEKXml]
(@xmlstr ntext)
as
begin
declare @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr
insert into tbl_weekquake
select xml.time,xml.longitude,xml.latitude,xml.depth,xml.mag,xml.type,xml.description,xml.text
from OPENXML(@hDoc,'/q:quakeml/eventParameters/event',2)
with([time] varchar(300) 'times',
latitude numeric(18,6),
longitude numeric(18,6) ,
depth varchar(50),
mag varchar(50)'magnitude',
type varchar(50) 'mag_type',
description varchar(max) 'placer',
[text] varchar(50)'type')xml
exec sp_xml_removedocument @hDoc
END
推荐答案
对于WordProcessingDocument中已加载文档的原始文本,可以使用.
For raw text of loaded document in WordProcessingDocument, you can use.
string rawText = wordprocessingDocument.MainDocumentPart.Document.ChildElements[0].InnerText;
对于XML:
string rawText = wordprocessingDocument.MainDocumentPart.Document.ChildElements[0].InnerXml;
这篇关于使用OPENXML()提取XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文