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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:50:10+00:00 2026-05-14T15:50:10+00:00

Basically, the initial problem is I need to make a boolean value serialize as

  • 0

Basically, the initial problem is I need to make a boolean value serialize as 0 or 1. The solution I found was to implement IXmlSerializable, which I did. Unfortunately the class I’m trying to serialize is generated code off a schema and has an XmlTypeAttribute on it. When I try to (de)serialize the object with the XmlSerializer created in the usual manner ( new XmlSerializer(type)) it throws this exception:

System.InvalidOperationException: Only XmlRoot attribute may be specified for the type ______ Please use XmlSchemaProviderAttribute to specify schema type.

Two options come to mind immediatly:

1) remove the attribute in the generated code.
This change would have to be made every time the code was re-generated.

2) Use an XmlAttributeOverrides object when creating the serializer to remove the attribute. This would require the rest of the code base to “know” that it needs to override that attribute. Also, the exception thrown gives absolutly no clue as to what needs to be done to fix it.

Both options kinda stink. Is there a third option?

  • 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-14T15:50:11+00:00Added an answer on May 14, 2026 at 3:50 pm

    I have the same problem, for me removing the IXMLSerializable works, I don’t use it, and have you tried to hide the true or false with a some logic in the properties? Like this:

    private bool mblnFlag;
    
    public String Flag 
    {
       get
       {
          return mblnFlag;
       }
       set
       {
          mblnFlag = (value == "1")
       }
    }
    

    Of course you should enhance the properties and do more checking, but that’s the idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I need to get older version of a file in the repository without
I need help solving the problem below. I am creating a Windows Forms Application
Basically I have a datagridview which I retrieve from database and 3 of the
Basically I'm having a problem with getting google maps to tag addresses that are
I have to wait for an event to be triggered. My initial solution was
I think i can simplify the problem domain. Basically i have set the preference
Consider the following problem: We have two sequences of cargo loads which can contain
I have an informational pop-up modal in my web application, which is basically just
Maybe there is a really simple solution for my problem, but I'm really confused
I'm trying to implement basic http authentication, but I need to return different HTTP

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.