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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:10:18+00:00 2026-06-13T12:10:18+00:00

I used xsd.exe from Microsoft SDKs to first generate a schema of an xml

  • 0

I used xsd.exe from Microsoft SDKs to first generate a schema of an xml file and then generate a C# file of the previously generated xsd file.
Here is my xml file:

<event topic="event.system.visualization.initialization.response" subject="CIBEK204Test0" producer="de.cibek.configurator" timeToLive="0" too="1351252459919" duration="0">
<payload>
    <![CDATA[
        <?xml version="1.0" encoding="UTF-8" standalone="no"?>
            <building>
                <floor name="">
                    <location name="Wohnen">
                        <item category="event.environment.apartment.window" groupaddress="10248" location="Wohnen" location.floor="" location.specification="Mitte links"/>
                    </location>
                </floor>
            </building>
    ]]>
</payload>
<properties/>
<traces/>

Now the generated xsd:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="event">
 <xs:complexType>
  <xs:sequence>
    <xs:element name="payload" type="xs:string" minOccurs="0" msdata:Ordinal="0" />
    <xs:element name="properties" type="xs:string" minOccurs="0" msdata:Ordinal="1" />
    <xs:element name="traces" type="xs:string" minOccurs="0" msdata:Ordinal="2" />
  </xs:sequence>
  <xs:attribute name="topic" type="xs:string" />
  <xs:attribute name="subject" type="xs:string" />
  <xs:attribute name="producer" type="xs:string" />
  <xs:attribute name="timeToLive" type="xs:string" />
  <xs:attribute name="too" type="xs:string" />
  <xs:attribute name="duration" type="xs:string" />
 </xs:complexType>
 </xs:element>
 <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
  <xs:complexType>
  <xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element ref="event" />
  </xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

And the generated cs file:

using System.Xml.Serialization;

// 
// This source code was auto-generated by xsd, Version=4.0.30319.17929.
// 


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class @event {

private string payloadField;

private string propertiesField;

private string tracesField;

private string topicField;

private string subjectField;

private string producerField;

private string timeToLiveField;

private string tooField;

private string durationField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string payload {
    get {
        return this.payloadField;
    }
    set {
        this.payloadField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string properties {
    get {
        return this.propertiesField;
    }
    set {
        this.propertiesField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string traces {
    get {
        return this.tracesField;
    }
    set {
        this.tracesField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string topic {
    get {
        return this.topicField;
    }
    set {
        this.topicField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string subject {
    get {
        return this.subjectField;
    }
    set {
        this.subjectField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string producer {
    get {
        return this.producerField;
    }
    set {
        this.producerField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string timeToLive {
    get {
        return this.timeToLiveField;
    }
    set {
        this.timeToLiveField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string too {
    get {
        return this.tooField;
    }
    set {
        this.tooField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string duration {
    get {
        return this.durationField;
    }
    set {
        this.durationField = value;
    }
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class NewDataSet {

private @event[] itemsField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("event")]
public @event[] Items {
    get {
        return this.itemsField;
    }
    set {
        this.itemsField = value;
    }
}
}

Now my question is: Why does xsd.exe ignore the embedded xml code in CDATA? Is there any possibility to force xsd.exe to NOT ignore CDATA? Or is it possible to generate 2 xsd and cs files and tell the first one (with event in it) that there is a CDATA node that has another xml file in it and link them in the generated code?

Sorry for the long post i hope anyone can help me 🙂

  • 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-13T12:10:19+00:00Added an answer on June 13, 2026 at 12:10 pm

    If CDATA is used, the parser ignores everything inside the CDATA section. If your aim is to get the section inside CDATA, please follow this link.

    Getting CDATA XML Section Using Linq

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

Sidebar

Related Questions

I used xsd.exe to create a class from xml schema. It generated several partial
I've created an .xsd file and then used XSD.exe to generate the .cs file
I used the xsd.exe tool to generate a class based on my xml schema.
I auto generated an xsd file from the below xml and used xsd2code to
Here is a schema file, midi.xsd that defines a type, note , used to
I created an XSD file from Visual Studio and can generate a sample XML
Good day. How to parse XML Schema(.xsd) file and generate to c# class file.
I created an .xsd from an xml file using XSD.Exe from the Visual Studio
I am new to xml's. I have used xsd.exe to create a .xsd file
I used xsd.exe on a remote xsd file to generate some C# class definitions.

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.