0

我对Get Element Filtering by Attribute的最后一个问题有未解决的问题,这是以下 XML:

    <?xml version="1.0" encoding="utf-8"?>
<assertions>
    <assertion id="SLM_CekNonNegative">
        <satisfied count="36"/>
        <unsatisfied count="4">
            <message xml:lang="id">(Record ID = ID_2) SLM: Jumlah bulan lalu, jumlah bulan laporan, jumlah hari tunggakan, dan jumlah tunggakan pokok tidak boleh kosong dan harus diisi >= 0</message>
            <message xml:lang="id">(Record ID = ID_2) SLM: Jumlah bulan lalu, jumlah bulan laporan, jumlah hari tunggakan, dan jumlah tunggakan pokok tidak boleh kosong dan harus diisi >= 0</message>
            <message xml:lang="id">(Record ID = ID_2) SLM: Jumlah bulan lalu, jumlah bulan laporan, jumlah hari tunggakan, dan jumlah tunggakan pokok tidak boleh kosong dan harus diisi >= 0</message>
            <message xml:lang="id">(Record ID = ID_2) SLM: Jumlah bulan lalu, jumlah bulan laporan, jumlah hari tunggakan, dan jumlah tunggakan pokok tidak boleh kosong dan harus diisi >= 0</message>
        </unsatisfied>
    </assertion>
    <assertion id="Base_CekJangkaWaktuMulaiLebihMudaJatuhTempo">
        <satisfied count="10"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="SLM_CekJumlahBulanKrgDrNilaiKontrak">
        <satisfied count="10"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_CekTanggalLebihMudaTanggalPelaporan">
        <satisfied count="10"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="SLM_CekNilaiKontrak">
        <satisfied count="2"/>
        <unsatisfied count="8">
            <message xml:lang="id">(Record ID = ID_10) Nilai kontrak harus > 0</message>
            <message xml:lang="id">(Record ID = ID_9) Nilai kontrak harus > 0</message>
            <message xml:lang="id">(Record ID = ID_8) Nilai kontrak harus > 0</message>
            <message xml:lang="id">(Record ID = ID_7) Nilai kontrak harus > 0</message>
            <message xml:lang="id">(Record ID = ID_6) Nilai kontrak harus > 0</message>
            <message xml:lang="id">(Record ID = ID_5) Nilai kontrak harus > 0</message>
            <message xml:lang="id">(Record ID = ID_2) Nilai kontrak harus > 0</message>
            <message xml:lang="id">(Record ID = ID_1) Nilai kontrak harus > 0</message>
        </unsatisfied>
    </assertion>
    <assertion id="SLM_CekGolNasabah">
        <satisfied count="9"/>
        <unsatisfied count="1">
            <message xml:lang="id">(Record ID = ID_2) Golongan nasabah tidak boleh diisi sandi bank pelapor sendiri</message>
        </unsatisfied>
    </assertion>
    <assertion id="BS-IF_CekSLMVls">
        <satisfied count="1"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="BS-IF_CekSLMIDR">
        <satisfied count="1"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_CekHubunganTidakTerkaitStatusLainnya">
        <satisfied count="8"/>
        <unsatisfied count="2">
            <message xml:lang="id">(Record ID = ID_3) Base: "Status hubungan dengan Bank" harus terisi sandi 9 jika Kolom "Klasifikasi Nasabah - Hubungan dengan bank" terisi sandi 2</message>
            <message xml:lang="id">(Record ID = ID_2) Base: "Status hubungan dengan Bank" harus terisi sandi 9 jika Kolom "Klasifikasi Nasabah - Hubungan dengan bank" terisi sandi 2</message>
        </unsatisfied>
    </assertion>
    <assertion id="Base_CekLembagaNilaiPemeringkat">
        <satisfied count="0"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_CekNeracaMinNol">
        <satisfied count="0"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_CekNilaiAgunanMinNol">
        <satisfied count="0"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_CekPersentaseMaksimal100">
        <satisfied count="0"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_CekLembaga-Tanggal-NilaiPeringkat">
        <satisfied count="0"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_CekIdentifier">
        <satisfied count="1"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_CekNomor-JumlahAgunan">
        <satisfied count="0"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_CekEligibilityJenisAgunan">
        <satisfied count="0"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_CekSifat-GolonganPenerbitAgunan">
        <satisfied count="0"/>
        <unsatisfied count="0"/>
    </assertion>
    <assertion id="Base_cekPeriod">
        <satisfied count="1"/>
        <unsatisfied count="0"/>
    </assertion>
</assertions>

我怎样才能得到<assertion id="SLM_CekNonNegative">which is的值SLM_CekNonNegative

以下是我到目前为止的代码:

string pathasr = @"D:\HARPITNAS\dari mbak julia\logs\123456789-2012-09-30-BSMS10.xml-assertions2.xml";
List<string> msg = new List<string>();
XmlDocument doc = new XmlDocument();
doc.Load(pathasr);

foreach (XmlNode node in doc.DocumentElement)
{
     string thevaluethatiwantvariable = string.Empty;  
     thevaluethatiwantvariable  = ? ;

     if (node.LastChild.HasChildNodes == true)
     {
          string count = node.LastChild.ChildNodes.Count.ToString();
          foreach (XmlNode y in node.LastChild.ChildNodes)
          {
               string masg = y.InnerXml;
               msg.Add(masg);
          }
     }
}

这段代码没有得到我想要的值。当我调试它时,我可以看到它没有得到正确的值。是否有可能获得我想要的价值?

4

1 回答 1

0

好的,我有问题,

我得到了它node.Attributes["id"].Value;thevaluethatiwantvariable谢谢

于 2013-03-18T04:13:17.813 回答