请教SQL中关于XML解析的问题?

liu_ke_ya 2012-06-06 11:17:23

--如何解析这段代码中所有的信息呢?自己试了一下openxml感觉并列分支太多,不知道怎么分?如果用xquery呢?
就是要提取每个节点下的内容,像country,date等等这些值(像country这些有重复,这时就要附加节点属性来区分,比如附加num。。其他雷同)

<?xml version="1.0" encoding="UTF-8"?>
<us-bibliographic-data-grant>
<classification-national>
<country>US</country>
</classification-national>
<invention-title id="d2e53">Undergarment</invention-title>
<references-cited>
<citation>
<patcit num="00001">
<document-id>
<country>US</country>
<date>19130233</date>
</document-id>
</patcit>
<classification-national><country>US</country><main-classification>602 67</main-classification></classification-national>
</citation>
<citation>
<patcit num="00002">
<document-id>
<country>US</country>
<date>19200599</date>
</document-id>
</patcit>
<classification-national><country>US</country><main-classification>602 67</main-classification></classification-national>
</citation>
</references-cited>
</us-bibliographic-data-grant>

...全文
87 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
liu_ke_ya 2012-06-07
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 的回复:]

可以将xml读取成二维表的形式,也可以单独读取某个节点的数据。

不知道你想怎么处理。
[/Quote]

我想将节点的数据取出,整理后放入表中。
liu_ke_ya 2012-06-06
  • 打赏
  • 举报
回复
只要能提取出信息就行,形式不要求。。
liangCK 2012-06-06
  • 打赏
  • 举报
回复
可以将xml读取成二维表的形式,也可以单独读取某个节点的数据。

不知道你想怎么处理。
liu_ke_ya 2012-06-06
  • 打赏
  • 举报
回复
看来只好分成多个表处理了。。

22,210

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧