如何将属性名称分配给字符串数组以获取更多名称空间

时间:2016-01-28 03:52:05

标签: c# xml

我必须得到命名空间thredds的name属性到字符串array.i需要获取文件到数组的名称(thredds:dataset name)。 我试过doc.Root.Elements ()select dataset

var 
names = rows.Select(o => (string)o.Element("name")).ToArray();

但不工作。请建议我.xml就像这样

<thredds:catalog xmlns:thredds="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:bes="http://xml.opendap.org/ns/bes/1.0#">
<thredds:service name="dap" serviceType="OPeNDAP" base="/opendap/hyrax"/>
<thredds:service name="file" serviceType="HTTPServer" base="/opendap/hyrax"/>
<thredds:service name="wms" serviceType="WMS" base="/ncWMS/wms"/>
<thredds:dataset name="/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014" ID="/opendap/hyrax/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014/">
<thredds:dataset name="OMI-Aura_L3-OMTO3e_2014m0101_v003-2014m0103t013658.he5" ID="/opendap/hyrax/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014/OMI-Aura_L3-OMTO3e_2014m0101_v003-2014m0103t013658.he5">
<thredds:dataSize units="bytes">3003100</thredds:dataSize>
<thredds:date type="modified">2014-01-03T06:48:48</thredds:date>
<thredds:access serviceName="dap" urlPath="/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014/OMI-Aura_L3-OMTO3e_2014m0101_v003-2014m0103t013658.he5"/>
<thredds:access serviceName="wms" urlPath="?DATASET=lds/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014/OMI-Aura_L3-OMTO3e_2014m0101_v003-2014m0103t013658.he5&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities"/>
</thredds:dataset>
<thredds:dataset name="OMI-Aura_L3-OMTO3e_2014m0102_v003-2014m0104t004027.he5" ID="/opendap/hyrax/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014/OMI-Aura_L3-OMTO3e_2014m0102_v003-2014m0104t004027.he5">
<thredds:dataSize units="bytes">3030178</thredds:dataSize>
<thredds:date type="modified">2014-01-04T05:49:18</thredds:date>
<thredds:access serviceName="dap" urlPath="/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014/OMI-Aura_L3-OMTO3e_2014m0102_v003-2014m0104t004027.he5"/>
<thredds:access serviceName="wms" urlPath="?DATASET=lds/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014/OMI-Aura_L3-OMTO3e_2014m0102_v003-2014m0104t004027.he5&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities"/>
</thredds:dataset>
<thredds:dataset name="OMI-Aura_L3-OMTO3e_2014m0103_v003-2014m0105t013415.he5" ID="/opendap/hyrax/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014/OMI-Aura_L3-OMTO3e_2014m0103_v003-2014m0105t013415.he5">
<thredds:dataSize units="bytes">3019723</thredds:dataSize>
<thredds:date type="modified">2014-01-05T06:49:33</thredds:date>
<thredds:access serviceName="dap" urlPath="/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014/OMI-Aura_L3-OMTO3e_2014m0103_v003-2014m0105t013415.he5"/>
<thredds:access serviceName="wms" urlPath="?DATASET=lds/HDF-EOS5/Aura_OMI_Level3/OMTO3e.003/2014/OMI-Aura_L3-OMTO3e_2014m0103_v003-2014m0105t013415.he5&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities"/>
</thredds:dataset> 

0 个答案:

没有答案