+ -
当前位置:首页 → 问答吧 → 有高人能指点下吗?关于xml文件合并的

有高人能指点下吗?关于xml文件合并的

时间:2010-02-01

来源:互联网

有一个主的xml文件,名为root.xml,同时还有多个子xml文件。其中root.xml文件中的有一属性SubFileName,其属性值为那些子xml文件的文件名,
我想要做的就是用xmlreader来读root.xml文件,并用xmlwriter来将读取的节点存在任意的位置,当用xmlreader读到SubFileName属性时,将其对应的子xml文件也写入要保存的文件中。
例如root.xml文件中有这么一节点
<矢量数据信息 IsRoot="False" NodeID="1" DataType="None" NodeCaption="" NodeDescription="对矢量数据内容的说明" MaxOccurs="1" MinOccurs="1" Order="0" NodeCode="F" ImageKey="FeatureCls.png" SelectedImageKey="FeatureCls_1.png" IsCut="false">
      <数据信息 IsRoot="False" NodeID="2" DataType="None" NodeCaption="矢量数据信息" NodeDescription="" MaxOccurs="unbounded" MinOccurs="1" Order="0" NodeCode="F2172101014P" ImageKey="FeatureCls.png" SelectedImageKey="FeatureCls_1.png" Text="GLOSS月平均潮位站位数据" SubFileName="633999538997187500.xml" />
      <数据信息 IsRoot="False" NodeID="2" DataType="None" NodeCaption="矢量数据信息" NodeDescription="" MaxOccurs="unbounded" MinOccurs="1" Order="0" NodeCode="F1510101000P" ImageKey="FeatureCls.png" SelectedImageKey="FeatureCls_1.png" Text="领海基点" SubFileName="633999538997656250.xml" />
      <数据信息 IsRoot="False" NodeID="2" DataType="None" NodeCaption="矢量数据信息" NodeDescription="" MaxOccurs="unbounded" MinOccurs="1" Order="0" NodeCode="F1510103017L" ImageKey="FeatureCls.png" SelectedImageKey="FeatureCls_1.png" Text="渔业线" SubFileName="633999538998437500.xml" />
</矢量数据信息>
其对应的633999538997187500.xml,633999538997656250.xml,633999538998437500.xml的子文件中也是有内容的,也就是将其链接起来。
  望高人指点

作者: xishuai1195   发布时间: 2010-02-01