xmlDocument があり、クレジット スコアが追加されているかどうかを確認する必要があります。これを行うには、xmlNodes.SelectSingleNode を使用してから、innerText をチェックしています。
私の問題は次のとおりです。ノードの1つに、実際のノード名にIDフィールドがあります。したがって、C# はそれをノード名の一部として解釈していると思います。
public void DeperPostAppend()
{
DirectoryInfo CompDir = new DirectoryInfo(FilePrep.CompletedDirectory);
foreach (FileInfo File in CompDir.GetFiles())
{
// Load xml documents for sorting
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.Load(File.FullName);
}
catch
{
if (File.Extension != ".xml")
return;
}
//XmlNode auto = xmlDoc.SelectSingleNode("//ACORD//InsuranceSvcRq//PersAutoPolicyQuoteInqRq");
XmlNode home = xmlDoc.SelectSingleNode("//ACORD//InsuranceSvcRq//HomePolicyQuoteInqRq");
XmlNode creditAuto = xmlDoc.SelectSingleNode("//ACORD//InsuranceSvcRq//PersAutoPolicyQuoteInqRq//PersPolicy//CreditScoreInfo//CreditScore");
XmlNode creditHome = xmlDoc.SelectSingleNode("//ACORD//InsuranceSvcRq//HomePolicyQuoteInqRq//PersPolicy//CreditScoreInfo//CreditScore");
//if file is type home quote
if (File.Extension == ".xml" && creditHome != null)
{
if (creditHome.InnerText != "ERR" || creditHome.InnerText != "NOH")
{
DeperHome();
}
}
//If file is type Auto Quote
else if (File.Extension == ".xml" && creditAuto != null)
{
if (creditAuto.InnerText != "ERR" || creditAuto.InnerText != "NOH")
{
DeperAuto();
}
}
}
}//end DeperPostAppend
//ACORD//InsuranceSvcRq//HomePolicyQuoteInqRq//PersPolicy//CreditScoreInfo//CreditScore
PersPolicy が問題の場所です。ノードはドキュメント上で次のように表示されます。
<PersPolicy id="AE4562BEE086A92470D4">
すべてのドキュメントが変更され、何千ものドキュメントを処理する必要があるため、id 部分は無視したいと思います。