我有一个105MB大的字典XML文件。下面是嵌套方式的示例:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE lexdataset
SYSTEM "CollexML.dtd">
<superentry id="u583c10bfdbd326ba.31865a51.12110e76de1.-326"><entry publevel="2" id="u583c10bfdbd326ba.31865a51.12110e76de1.-325"><hwblk><hwgrp><hwunit><hw>aah</hw></hwunit></hwgrp></hwblk><datablk><gramcat publevel="2"><pospgrp><pospunit><posp value="verb"/></pospunit></pospgrp><sensecat publevel="2"><defgrp><defunit><def>exclaim in pleasure</def></defunit></defgrp></sensecat></gramcat></datablk></entry></superentry>
<superentry><entry publevel="2"><hwblk><hwgrp><hwunit form="inflected"><hw>aahed</hw></hwunit></hwgrp></hwblk><datablk><xrefgrp><xrefunit publevel="2"><xref superentryid="u583c10bfdbd326ba.31865a51.12110e76de1.-326" xrefid="u583c10bfdbd326ba.31865a51.12110e76de1.-325"><xrhw publevel="2">aah</xrhw></xref></xrefunit></xrefgrp></datablk></entry></superentry>
<superentry><entry publevel="2"><hwblk><hwgrp><hwunit form="inflected"><hw>aahing</hw></hwunit></hwgrp></hwblk><datablk><xrefgrp><xrefunit publevel="2"><xref superentryid="u583c10bfdbd326ba.31865a51.12110e76de1.-326" xrefid="u583c10bfdbd326ba.31865a51.12110e76de1.-325"><xrhw publevel="2">aah</xrhw></xref></xrefunit></xrefgrp></datablk></entry></superentry>
<superentry><entry publevel="2"><hwblk><hwgrp><hwunit form="inflected"><hw>aahs</hw></hwunit></hwgrp></hwblk><datablk><xrefgrp><xrefunit publevel="2"><xref superentryid="u583c10bfdbd326ba.31865a51.12110e76de1.-326" xrefid="u583c10bfdbd326ba.31865a51.12110e76de1.-325"><xrhw publevel="2">aah</xrhw></xref></xrefunit></xrefgrp></datablk></entry></superentry>
</lexdataset>
对我而言,阅读起来非常困难,我不确定如何输出它。有人有什么想法吗?
我想做的就是提取这些东西: 这个词本身 定义, 一个单词是否变形或派生
答案 0 :(得分:1)
我建议你试试BaseX的CSV模块。有关详细信息:http://docs.basex.org/wiki/CSV_Module
答案 1 :(得分:0)
对于通过搜索遇到此问题的任何人,我最终只是将行插入到我使用以下语法创建的新表中:
select
WordID = IDENTITY(INT,1,1),
a.b.value('(hwblk/hwgrp/hwunit/hw/text())[1]', 'nvarchar(250)') as [Word],
a.b.value('(datablk/xrefgrp/xrefunit/xref/xrhw/text())[1]', 'nvarchar(250)') as [Derivation],
a.b.value('(datablk/gramcat/sensecat/defgrp/defunit/def/text())[1]', 'nvarchar(250)') as [Definition],
a.b.value('(datablk/gramcat/pospgrp/pospunit/posp/@value)[1]', 'nvarchar(30)') as [POSP],
a.b.value('(hwblk/hwgrp/hwunit/@form)[1]', 'nvarchar(30)') as [Form],
a.b.value('(@publevel)', 'int') as [Ambiguity]
into Dictionary
from [dbo].[DictionaryXML] c
cross apply c.xmldata.nodes('lexdataset/superentry/entry') a(b)