0
我有我的最後一個問題尚未解決的問題上Get Element Filtering by Attribute,這是下面的XML:獲取元素的ID從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">
這是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);
}
}
}
此代碼不會得到我想要的價值。當我調試它時,我可以看到它沒有得到正確的值。有可能獲得我想要的價值嗎?
這Net框架您使用的是2.0? – Shrivallabh 2013-03-18 04:12:54