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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:23:51+00:00 2026-06-13T06:23:51+00:00

Is it possible to use XSD.exe to auto generate a class which has a

  • 0

Is it possible to use XSD.exe to auto generate a class which has a different datatype for an attribute than the one that is specified in the XSD by providing a annotation attribute before the element on the XSD.

The idea is, to keep the XSD just the way it is, but would like the auto generated class to have a different datatype for a specific attribute.

<xsd:simpleType name="idRestriction">
<Specify_Custom_Type="xsd:string" //This is what I'm looking for
<xsd:restriction base="xsd:decimal">

<xsd:attribute name="idAttribute" type="idRestriction" use="required" />

Generated class

[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal id { // Would like the decimal to be string
get {
            return this.idField;
        }
        set {
            this.idField = value;
        }
    }

What I would like it to generate

[System.Xml.Serialization.XmlAttributeAttribute()]
public string id { // Notice decimal --> string
get {
            return this.idField;
        }
        set {
            this.idField = value;
        }
    }
  • 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-13T06:23:53+00:00Added an answer on June 13, 2026 at 6:23 am

    Let’s assume you have schema.xsd file

    If you copy same file as schema2.xsd and replace all other primitive types to string, you can use this file for generating .cs class

    If you automate this process by writing a batch file, i think your problem can be resolved.

    Below link includes question about how to replace text file content. Please check that one

    How can you find and replace text in a file using the Windows command-line environment?

    I want to mention that there is one point when you generate .cs file from these files the class names will be the same. So it is better to use different name space for this both classes so the generated class types will not conflict.

    You can mention namespace by using /n parameter for xsd.exe

    Please check below link for xsd.exe command line parameter

    http://msdn.microsoft.com/en-us/library/x6c1kb0s(v=vs.110).aspx

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

Sidebar

Related Questions

Is it possible to use JMF in Android? JMF has good functionality? I'm basically
Is it possible to use django class based generic views with a ManyToManyField relation?
We use XML to define a model which we later use to generate code.
Not all that familiar with XSD, I wonder if it is possible to do
Is it possible to generate wsdl with use of SvcUtil or any other tool.
Is it possible use mod_rewrite to resolve addresses hosted on another server? Say I
Is it possible use a MySQL query to perform this kind of check? If
I need a control having these features: It should be possible use it in
Is possible to use ArcSDE API in .NET(C#) ? http://edndoc.esri.com/arcsde/9.2/api/capi/dbconnects/dbconnects.htm Thanks
Is this possible to use Ajax.Beginform with update target inside of ajax form. like

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.