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 8501087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:06:47+00:00 2026-06-11T01:06:47+00:00

I am turning the BOM off in my code and it is still printing

  • 0

I am turning the BOM off in my code and it is still printing it in my xml document. I do not understand. I have looked into many sources and still nothing and should just start with

my code does this is general

XDocument xmlDoc = XDocument.Load(CompDir + File.Name);

AppendToFile(xmlDoc, aDataRow);

using (var writer = new XmlTextWriter
    (FilePrep.CompletedDirectory + File.Name, new UTF8Encoding(false))) 
    { 
    xmlDoc.Save(writer);
    writer.Close();
    }
break;

and the append to file looks like this

private void AppendToFile(XDocument xmlDoc, DataRow aDataRow)
{
    //String StrName = aDataRow.ItemArray.GetValue(5).ToString() + ' ' + aDataRow.ItemArray.GetValue(6).ToString();

    try
    {
        XElement foundEl = xmlDoc.Descendants("CreditScoreInfo").First();
        foundEl.Add(new XElement("CreditScore", aDataRow.ItemArray.GetValue(2)),
                    new XElement("CreditScoreDt", aDataRow.ItemArray.GetValue(1)));
                    //,new XElement("ScoredName", StrName)); 
    }
    catch
    {
       XElement persPolicy = xmlDoc.Descendants("PersPolicy").First();
                persPolicy.Add(new XElement("CreditScoreInfo",
                    new XElement("CreditScore", aDataRow.ItemArray.GetValue(2)),
                    new XElement("CreditScoreDt", aDataRow.ItemArray.GetValue(1))));
                    //,new XElement("ScoredName", StrName)));
    }
}
  • 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-11T01:06:48+00:00Added an answer on June 11, 2026 at 1:06 am

    Could you try this as an alternative way:

    XmlWriterSettings settings = new XmlWriterSettings();
    settings.Encoding = new UTF8Encoding(false);
    
    using (XmlWriter writer = XmlWriter.Create(FilePrep.CompletedDirectory + File.Name, settings))
    {
        xmlDoc.Save(writer);
        writer.Close();
    }
    
    • http://msdn.microsoft.com/en-us/library/bb336977.aspx
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey im not getting anywhere with turning wcf into a restful service. So I
Possible Duplicate: jQuery 1.7 - Turning live() into on() Just switching my code from
I have an API which I am turning into an internal DSL. As such,
I have problem with turning this code: void dfs(int i = 1) { static
I am turning some piece of Python code into OO-code. I define a class
I have a question with turning this html into erb. <button name=support type=button value=Get
Other than turning warnings off.. what can I do in my code to get
I am turning an project that I have been working on for while into
Any client js libraries for turning XML into a JavaScript object? I'm specifically working
When I think of compiling I think of turning C++ code into a binary.

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.