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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:35:43+00:00 2026-06-11T20:35:43+00:00

I have following xsd: <?xml version=1.0 encoding=UTF-8?> <xsd:schema targetNamespace=http://www.something.com/GetWrapRequest elementFormDefault=qualified attributeFormDefault=qualified version=1.0 xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:gwreq=http://www.something.com/GetWrapRequest>

  • 0

I have following xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
        targetNamespace="http://www.something.com/GetWrapRequest"
        elementFormDefault="qualified" attributeFormDefault="qualified" version="1.0"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:gwreq="http://www.something.com/GetWrapRequest">

    <xsd:element name="message" type="gwreq:Message">
        <xsd:annotation>
            <xsd:documentation>Complete message</xsd:documentation>
        </xsd:annotation>
    </xsd:element>
    <xsd:complexType name="Message">
        <!-- something here -->
    </xsd:complexType>
</xsd:schema>

And for generating C# class I am using modified code from http://hosca.com/blog/post/2008/12/26/Generating-C-classes-from-FpML-Schema.aspx I cannot use usual xsd.exe because I need to create C# namespaces from XML namespaces and xsd.exe is placing all classes to one C# namespace. So I found this piece of code and I exteded it to create correct namespaces. But all the parts related to converting xsd to CodeDom is still the same.

My problem now is that the xsd.exe is generating this:

[System.Xml.Serialization.XmlRootAttribute("message", Namespace="http://www.something.com/GetWrapRequest", IsNullable=true)]
public partial class Message {}

and my code is generating this:

[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.something.com/GetWrapRequest", IsNullable=true)]
public partial class Message {}

As you can see the “message” with lower “m” is missing in the attribute. And because the xml I need to deserialize is also with the tag “message” with lower “m” deserialization fails.

How can I solve this? I looked at options of XmlSchemaImporter and XmlCodeExporter but nothing can do the trick. Or can I somehow set up XmlSerializer to disable case sensitivity?

  • 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-11T20:35:45+00:00Added an answer on June 11, 2026 at 8:35 pm

    So after sneaking in the Xsd2Code source code I found interesting thing. I am using these two loops to create xml mapping

    foreach (XmlSchemaType schemaType in rootSchema.SchemaTypes.Values)
        xmlTypeMappings.Add(xmlSchemaImporter.ImportSchemaType(schemaType.QualifiedName));
    foreach (XmlSchemaElement schemaElement in rootSchema.Elements.Values)
        xmlTypeMappings.Add(xmlSchemaImporter.ImportTypeMapping(schemaElement.QualifiedName));
    

    But in the Xsd2Code they are processing elements first and schema types after it. So I just change the order of these to loops like this:

    foreach (XmlSchemaElement schemaElement in rootSchema.Elements.Values)
        xmlTypeMappings.Add(xmlSchemaImporter.ImportTypeMapping(schemaElement.QualifiedName))
    foreach (XmlSchemaType schemaType in rootSchema.SchemaTypes.Values)
        xmlTypeMappings.Add(xmlSchemaImporter.ImportSchemaType(schemaType.QualifiedName));
    

    And proper XmlRootAttribute with the element name “message” is generated.

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

Sidebar

Related Questions

I have the following xsd files: SchemaA <?xml version=1.0 encoding=utf-8?> <xs:schema targetNamespace=http://schemaA elementFormDefault=qualified xmlns=http://schemaA
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 start of an XSD: <?xml version=1.0 encoding=UTF-8?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:no=http://www.sychophants.com>
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 following plist: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
I have an XSD of this form: <?xml version=1.0 encoding=UTF-8?> <schema xmlns=http://www.w3.org/2001/XMLSchema targetNamespace=http://www.example.org/example xmlns:tns=http://www.example.org/example
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 following XML file: <?xml version=1.0 encoding=UTF-8?> <beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:jaxrs=http://cxf.apache.org/jaxrs xmlns:context=http://www.springframework.org/schema/context xmlns:cxf=http://cxf.apache.org/core
I have the following XML <?xml version=1.0 encoding=UTF-8 ?> <GovTalkMessage xsi:schemaLocation=http://www.govtalk.gov.uk/CM/envelope http://xmlgw.companieshouse.gov.uk/v1-0/schema/Egov_ch-v2-0.xsd xmlns=http://www.govtalk.gov.uk/CM/envelope xmlns:dsig=http://www.w3.org/2000/09/xmldsig#
I have xml file whose structure is defined with following xsd: <?xml version=1.0 encoding=utf-8?>

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.