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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:45:52+00:00 2026-05-12T11:45:52+00:00

The file format I’m working with (OFX) is XML-like and contains a bunch of

  • 0

The file format I’m working with (OFX) is XML-like and contains a bunch of plain-text stuff before the XML-like bit begins. It doesn’t like having between the plain-text and XML parts though, so I’m wondering if there’s a way to get XmlSerialiser to ignore that. I know I could go through the file and wipe out that line but it would be simpler and cleaner to not write it in the first place! Any ideas?

  • 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-05-12T11:45:52+00:00Added an answer on May 12, 2026 at 11:45 am

    Not too tough, you just have to serialize to an explicitly declared XmlWriter and set the options on that writer before you serialize.

    public static string SerializeExplicit(SomeObject obj)
    {    
        XmlWriterSettings settings;
        settings = new XmlWriterSettings();
        settings.OmitXmlDeclaration = true;
    
        XmlSerializerNamespaces ns;
        ns = new XmlSerializerNamespaces();
        ns.Add("", "");
    
    
        XmlSerializer serializer;
        serializer = new XmlSerializer(typeof(SomeObject));
    
        //Or, you can pass a stream in to this function and serialize to it.
        // or a file, or whatever - this just returns the string for demo purposes.
        StringBuilder sb = new StringBuilder();
        using(var xwriter = XmlWriter.Create(sb, settings))
        {
    
            serializer.Serialize(xwriter, obj, ns);
            return sb.ToString();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file format that contains a structure of questions: <question id=q101>
I have a log file in text file format. the log file looks like
File Format # [filename].[2 letter locale].[outputformat - html/subject/text].xml Valid filenames - myname.en.html.xml myname2.pt.subject.xml etc.
I have text file format like this SKI SKII SKIII SKIV SKV SKVI SKVII
I'm working on a file format that should be written and read in several
I am working with a legacy file format. The file is created using unmanaged
When parsing a custom (text) file format in Java, what is the appropriate exception
The file format my application uses is Xml based. I just got a customer
I have a custom file format for graphs which looks like this: node1.link1 :
The MS-XLS file format contains streams, substreams, and records. - Understanding the Excel MS-XLS

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.