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

The Archive Base Latest Questions

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

I have the following elements in my schema: <xs:schema attributeFormDefault=unqualified elementFormDefault=qualified xmlns:xs=http://www.w3.org/2001/XMLSchema> <xs:complexType name=optimizeModelBase>

  • 0

I have the following elements in my schema:

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="optimizeModelBase">
    <xs:attribute name="name" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="riskModel">
    <xs:complexContent>
      <xs:extension base="optimizeModelBase">
        <xs:attribute name="type" type="xs:string" use="required"/>        
      </xs:extension>      
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="fullCovariance">
    <xs:complexContent>
      <xs:extension base="optimizeModelBase">
        <xs:attribute name="fromDate" type="xs:date" use="required"/>
        <xs:attribute name="toDate" type="xs:date" use="required"/>
        <xs:attribute name="windowSize" type="xs:int" use="required"/>
      </xs:extension>
    </xs:complexContent>    
  </xs:complexType>

In my main schema body, I use a element to specify a 1-of situation:

<xs:choice id="RiskModelParameter">
  <xs:element name="RiskModel" type="riskModel"/>
  <xs:element name="FullCovariance" type="fullCovariance"/>
</xs:choice>

When I run xsd.exe, the resulting code is:

    [System.Xml.Serialization.XmlElementAttribute("FullCovariance",
    typeof(fullCovariance))]
    [System.Xml.Serialization.XmlElementAttribute("RiskModel", 
    typeof(riskModel))]
    public optimizeModelBase Item 
    {
        get 
        {
           return this.itemField;
        } 
        set 
        {
            this.itemField = value;
        }
    }

The issue is that the element’s ID tag is being ignored, and xsd.exe is arbitrarily naming the property “Item”. I have to admit, it’s not a big issue, but it’s starting to annoy me. What makes this extra annoying is that if I have additional elements at the same level, xsd.exe binds them as “Item1”, “Item2”, etc.

Does anyone know if it’s possible to not have xsd.exe name my choice elements as “Item”, and instead be able to put in my own property names?

  • 1 1 Answer
  • 1 View
  • 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:28:01+00:00Added an answer on May 14, 2026 at 3:28 pm

    I’ve searched high and low, but it seems like there is no solution for my problem. According to the link:

    http://msdn.microsoft.com/en-us/library/sa6z5baz(VS.80).aspx
    It seems like the arbitrary naming of the choice element is not overrideable. Hopefully this information is helpful to others out there…!

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

Sidebar

Related Questions

We have this XML schema: <xs:schema attributeFormDefault=unqualified elementFormDefault=qualified xmlns:xs=http://www.w3.org/2001/XMLSchema> <xs:element name=Log> <xs:complexType> <xs:sequence minOccurs=0
I have following xml: <xs:schema attributeFormDefault=unqualified elementFormDefault=qualified xmlns=http://www.testuri.org targetNamespace=http://www.testuri.org xmlns:xs=http://www.w3.org/2001/XMLSchema> <xs:element name=Price> <xs:complexType> <xs:sequence>
Suppose we have the following schema: <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema> <xs:element name=root> <xs:complexType> <xs:sequence> <xs:element name=a_elements>
I have the following .xsd code: <?xml version=1.0 encoding=UTF-8?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema id=MyDataSet> <xs:element name=Row>
I have the following xml schema: <?xml version=1.0 encoding=utf-8?> <xsd:schema xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:xsd=http://www.w3.org/2001/XMLSchema attributeFormDefault=unqualified
I have the following schema: <?xml version=1.0 encoding=UTF-8?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:m=http://ws.mypackage.com xmlns:xmime=http://www.w3.org/2005/05/xmlmime elementFormDefault=qualified targetNamespace=http://ws.mypackage.com
I have a schema with following attributes in schema element: <schema xmlns=http://www.w3.org/2001/XMLSchema xmlns:abc=http://abc.example.com targetNamespace=http://abc.example.com
I have following XML schema: <?xml version=1.0 encoding=UTF-8 standalone=no?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema> <xs:element name=content type=contentType/>
I have two xsd files: base.xsd : <schema targetNamespace=http://www.myorg.com/base elementFormDefault=qualified attributeFormDefault=unqualified xmlns=http://www.w3.org/2001/XMLSchema> ... <complexType
I have the following XML: <?xml version=1.0?> <coll xmlns=http://www.example.org/coll xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.example.org/coll coll.xsd> <collection> <item

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.