在R中解析大型xml文件

时间:2016-07-06 14:21:56

标签: r xml

我一直在努力在R中加载/解析我的xml文件。我已经尝试了XML和xml2包,没有运气。文件大小为275,000kb。我已经能够加载其他xml文件并解析数据,但我似乎无法解决这个问题。

以下是xml文件的示例:

    <?xml version="1.0" standalone="yes"?>
<T_WC>
  <xs:schema id="T_WC" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="T_WC" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Table">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="api_st_cde" type="xs:short" minOccurs="0" />
                <xs:element name="api_cnty_cde" type="xs:short" minOccurs="0" />
                <xs:element name="api_well_idn" type="xs:int" minOccurs="0" />
                <xs:element name="pool_idn" type="xs:int" minOccurs="0" />
                <xs:element name="eff_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="ogrid_cde" type="xs:int" minOccurs="0" />
                <xs:element name="well_typ_cde" type="xs:string" minOccurs="0" />
                <xs:element name="sdiv_twp_idn" type="xs:string" minOccurs="0" />
                <xs:element name="sdiv_rng_idn" type="xs:string" minOccurs="0" />
                <xs:element name="sdiv_sect_num" type="xs:short" minOccurs="0" />
                <xs:element name="sdiv_unlt_idn" type="xs:string" minOccurs="0" />
                <xs:element name="lot_idn" type="xs:string" minOccurs="0" />
                <xs:element name="ftg_ns_num" type="xs:short" minOccurs="0" />
                <xs:element name="ftg_ew_num" type="xs:short" minOccurs="0" />
                <xs:element name="ns_cde" type="xs:string" minOccurs="0" />
                <xs:element name="ew_cde" type="xs:string" minOccurs="0" />
                <xs:element name="compl_typ_cde" type="xs:string" minOccurs="0" />
                <xs:element name="compl_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="dpth_perf_top_num" type="xs:int" minOccurs="0" />
                <xs:element name="dpth_perf_btm_num" type="xs:int" minOccurs="0" />
                <xs:element name="fst_oil_prodn_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="fst_gas_deliv_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="tst_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="prodn_meth_cde" type="xs:string" minOccurs="0" />
                <xs:element name="tst_len_tim" type="xs:string" minOccurs="0" />
                <xs:element name="tbg_pres_num" type="xs:int" minOccurs="0" />
                <xs:element name="csg_pres_num" type="xs:int" minOccurs="0" />
                <xs:element name="choke_siz_dec" type="xs:decimal" minOccurs="0" />
                <xs:element name="tst_oil_amt" type="xs:decimal" minOccurs="0" />
                <xs:element name="tst_wtr_amt" type="xs:decimal" minOccurs="0" />
                <xs:element name="tst_gas_amt" type="xs:decimal" minOccurs="0" />
                <xs:element name="api_grav_dec" type="xs:decimal" minOccurs="0" />
                <xs:element name="tst_meth_cde" type="xs:string" minOccurs="0" />
                <xs:element name="tst_gor_dec" type="xs:decimal" minOccurs="0" />
                <xs:element name="wc_stat_cde" type="xs:string" minOccurs="0" />
                <xs:element name="tst_gas_dispn_cde" type="xs:string" minOccurs="0" />
                <xs:element name="spc_unit_idn" type="xs:int" minOccurs="0" />
                <xs:element name="prod_prop_idn" type="xs:int" minOccurs="0" />
                <xs:element name="well_nbr_idn" type="xs:string" minOccurs="0" />
                <xs:element name="vent_apr_cde" type="xs:string" minOccurs="0" />
                <xs:element name="vent_apr_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="vent_apr_expr_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="ocd_lease_num" type="xs:string" minOccurs="0" />
                <xs:element name="well_class_cde" type="xs:decimal" minOccurs="0" />
                <xs:element name="well_grp_num" type="xs:short" minOccurs="0" />
                <xs:element name="bh_psd_act_ind" type="xs:string" minOccurs="0" />
                <xs:element name="sdiv_consol_cde" type="xs:string" minOccurs="0" />
                <xs:element name="dhc_cmngl_ind" type="xs:string" minOccurs="0" />
                <xs:element name="ocd_ord_typ_cde" type="xs:string" minOccurs="0" />
                <xs:element name="ocd_ord_num" type="xs:int" minOccurs="0" />
                <xs:element name="ocd_ord_sfx_idn" type="xs:string" minOccurs="0" />
                <xs:element name="dhc_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="nfo_prmt_num" type="xs:int" minOccurs="0" />
                <xs:element name="nfo_eff_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="nfo_expr_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="deliv_tst_q_num" type="xs:int" minOccurs="0" />
                <xs:element name="c104_apr_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="gas_conn_dte" type="xs:dateTime" minOccurs="0" />
                <xs:element name="ocd_unlt_idn" type="xs:string" minOccurs="0" />
                <xs:element name="rec_termn_dte" type="xs:dateTime" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <Table>
    <api_st_cde>30</api_st_cde>
    <api_cnty_cde>1</api_cnty_cde>
    <api_well_idn>5002</api_well_idn>
    <pool_idn>96838</pool_idn>
    <eff_dte>1964-04-24T00:00:00-06:00</eff_dte>
    <ogrid_cde>196291</ogrid_cde>
    <well_typ_cde>G</well_typ_cde>
    <sdiv_twp_idn>10N</sdiv_twp_idn>
    <sdiv_rng_idn>05E</sdiv_rng_idn>
    <sdiv_sect_num>12</sdiv_sect_num>
    <sdiv_unlt_idn>D  </sdiv_unlt_idn>
    <lot_idn xml:space="preserve">      </lot_idn>
    <ftg_ns_num>985</ftg_ns_num>
    <ftg_ew_num>902</ftg_ew_num>
    <ns_cde>N</ns_cde>
    <ew_cde>W</ew_cde>
    <compl_typ_cde xml:space="preserve"> </compl_typ_cde>
    <compl_dte>9999-12-31T00:00:00-07:00</compl_dte>
    <dpth_perf_top_num>1</dpth_perf_top_num>
    <dpth_perf_btm_num>1</dpth_perf_btm_num>
  </Table>
  <Table>
    <api_st_cde>30</api_st_cde>
    <api_cnty_cde>1</api_cnty_cde>
    <api_well_idn>20007</api_well_idn>
    <pool_idn>96838</pool_idn>
    <eff_dte>1997-09-29T00:00:00-06:00</eff_dte>
    <ogrid_cde>14538</ogrid_cde>
    <well_typ_cde>G</well_typ_cde>
    <sdiv_twp_idn>10N</sdiv_twp_idn>
    <sdiv_rng_idn>01E</sdiv_rng_idn>
    <sdiv_sect_num>21</sdiv_sect_num>
    <sdiv_unlt_idn>G50</sdiv_unlt_idn>
    <lot_idn xml:space="preserve">      </lot_idn>
    <ftg_ns_num>640</ftg_ns_num>
    <ftg_ew_num>590</ftg_ew_num>
    <ns_cde>S</ns_cde>
    <ew_cde>W</ew_cde>
    <compl_typ_cde xml:space="preserve"> </compl_typ_cde>
    <compl_dte>9999-12-31T00:00:00-07:00</compl_dte>
    <dpth_perf_top_num>1</dpth_perf_top_num>
    <dpth_perf_btm_num>1</dpth_perf_btm_num>
  </Table>
  <Table>
    <api_st_cde>30</api_st_cde>
    <api_cnty_cde>1</api_cnty_cde>
    <api_well_idn>20010</api_well_idn>
    <pool_idn>96838</pool_idn>
    <eff_dte>2015-06-02T00:00:00-06:00</eff_dte>
    <ogrid_cde>5380</ogrid_cde>
    <well_typ_cde>G</well_typ_cde>
    <sdiv_twp_idn>10N</sdiv_twp_idn>
    <sdiv_rng_idn>01W</sdiv_rng_idn>
    <sdiv_sect_num>27</sdiv_sect_num>
    <sdiv_unlt_idn>G50</sdiv_unlt_idn>
    <lot_idn xml:space="preserve">      </lot_idn>
    <ftg_ns_num>800</ftg_ns_num>
    <ftg_ew_num>800</ftg_ew_num>
    <ns_cde>S</ns_cde>
    <ew_cde>E</ew_cde>
    <compl_typ_cde xml:space="preserve"> </compl_typ_cde>
    <compl_dte>9999-12-31T00:00:00-07:00</compl_dte>
    <dpth_perf_top_num>1</dpth_perf_top_num>
    <dpth_perf_btm_num>1</dpth_perf_btm_num>
   </Table>

0 个答案:

没有答案