Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7831001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:31:38+00:00 2026-06-02T11:31:38+00:00

So I have an xmlDocument and I need to check to see if a

  • 0

So I have an xmlDocument and I need to check to see if a credit score was appended. To do this I am using xmlNodes.SelectSingleNode and then checking the innerText.

My issue is this: one of the nodes has an ID field in the actual node name. So I think C# is interpreting that as part of the node name.

 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 is where the issue is. the node looks like this on the document.

<PersPolicy id="AE4562BEE086A92470D4">

I want to ignore the id portion due to the fact that it changes every document and i have thousands of docs to process.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T11:31:41+00:00Added an answer on June 2, 2026 at 11:31 am

    I just decided to use classes to handle the nodes as follows

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Xml.Linq;
    
    
    /// <summary>
    /// 
    /// </summary>
    
    public class PersPolicy
    {
        XElement self;
        public PersPolicy(XElement self) { this.self = self; }
    
        public CreditScoreInfo CreditScoreInfo { get { return _CreditScoreInfo ?? (_CreditScoreInfo = new CreditScoreInfo(self.Element("CreditScoreInfo"))); } }
        CreditScoreInfo _CreditScoreInfo;
    
        public string PolicyNumber
        {
            get { return (string)self.Element("PolicyNumber"); }
            set { self.Element("PolicyNumber").SetValue(value); }
        }
    }
    
    /// <summary>
    /// 
    /// </summary>
    public class CreditScoreInfo
    {
        XElement self;
        public CreditScoreInfo(XElement self) { this.self = self; }
    
        public string CreditScore
        {
            get { return (string)self.Element("CreditScore"); }
            set { self.Element("CreditScore").SetValue(value); }
        }
        public string CreditScoreDt
        {
            get { return (string)self.Element("CreditScoreDt"); }
            set { self.Element("CreditScoreDt").SetValue(value); }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm filling an XML document manually using C# and I need to have <data>
I have a .NET C# solution that builds complex XmlDocument then shoots it over
I'm new to xml in .net, And I have this requirements that i need
I have an xml template document that I need to load into an XmlDocument.
I have this problem: I have a method private XmlElement ToXmlElement(string xml) { XmlDocument
I need to load a number of xhtml files that have this at the
I have an XML file and I am loading it in Xmldocument. This document
I have an XML document that includes XPath expressions that I need to use
I have a xml document. I know the index where i need to insert
I have a loaded XDocument that I need to grab all the attributes that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.