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

  • Home
  • SEARCH
  • 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 7004479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:12:15+00:00 2026-05-27T21:12:15+00:00

I am trying to convert xsd file to the .net class. I have searched

  • 0

I am trying to convert xsd file to the .net class.
I have searched a lot for this topic and found xsd.exe as one of the way to achieve it, but I still have two concerns

  1. I don’t want to manually generate the classes from command prompt but want all this to get done on runtime. For that I tried to use System.Diagnostics.Process to run xsd.exe on runtime but could not get succeeded and also was getting a blinking command prompt window when process starts.

  2. I even didn’t get succeeded to get the classes generated from command prompt also. It is giving me error “Schema D:\Response.xsd could not be validated.”

So basically I am trying to implement something that will use my xsd string and deserialize it to one of my class’ type on runtime, something like we do with Xml string using XmlSerializer class.

I would like to mention that I think my xsd string is not of the general xsd types but kind of custom, an example of one of the responses is this

<?xml version="1.0" encoding="iso-8859-1"?>
<serv:message xmlns:serv="http://www.webex.com/schemas/2002/06/service"
xmlns:com="http://www.webex.com/schemas/2002/06/common"
xmlns:use="http://www.webex.com/schemas/2002/06/service/user">
    <serv:header>
        <serv:response>
            <serv:result>SUCCESS</serv:result>
            <serv:gsbStatus>BACKUP</serv:gsbStatus>
        </serv:response>
    </serv:header>
    <serv:body>
        <serv:bodyContent xsi:type="use:getLoginTicketResponse"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <use:ticket>5e9733eb9efeb02d80aa0551ef7e9ccd</use:ticket>
            <use:apiVersion>WebEx XML API V3.9.0</use:apiVersion>
        </serv:bodyContent>
    </serv:body>
</serv:message>

Edit –
I got succeeded in generating the class file for my xml now and here it is

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.webex.com/schemas/2002/06/service/user")]
public partial class getLoginTicketResponse : bodyContentType
{

    private string ticketField;

    private string apiVersionField;

    /// <remarks/>
    public string ticket
    {
        get
        {
            return this.ticketField;
        }
        set
        {
            this.ticketField = value;
        }
    }

    /// <remarks/>
    public string apiVersion
    {
        get
        {
            return this.apiVersionField;
        }
        set
        {
            this.apiVersionField = value;
        }
    }
}

And this is bodyContentType

/// <remarks/>
[System.Xml.Serialization.XmlIncludeAttribute(typeof(getLoginTicketResponse))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.webex.com/schemas/2002/06/service")]
[System.Xml.Serialization.XmlRootAttribute("getLoginTicket", Namespace = "http://www.webex.com/schemas/2002/06/service/user", IsNullable = false)]
public partial class bodyContentType
{
}

Now, trying to serialize it like this

var nameSpaceManager = new XmlNamespaceManager(responseXML.NameTable);
nameSpaceManager.AddNamespace("serv", "http://www.webex.com/schemas/2002/06/service");
nameSpaceManager.AddNamespace("com", "http://www.webex.com/schemas/2002/06/common");
nameSpaceManager.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
nameSpaceManager.AddNamespace("meet", "http://www.webex.com/schemas/2002/06/service/meeting");
nameSpaceManager.AddNamespace("att", "http://www.webex.com/schemas/2002/06/service/attendee");
nameSpaceManager.AddNamespace("use", "http://www.webex.com/schemas/2002/06/service/user");

XmlNode statusNode = responseXML.SelectSingleNode("/serv:message/serv:body", nameSpaceManager);
TextReader reader = new StringReader(s);
XmlSerializer serializer = new XmlSerializer(typeof(getLoginTicketResponse));

var obj = serializer.Deserialize(reader);

But keep on getting the error
“There is an error in XML document (1, 2).”
I tried changing many things in the xml string, but could not get succeeded

Any help will be appreciable!

  • 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-27T21:12:16+00:00Added an answer on May 27, 2026 at 9:12 pm

    Got a very decent and easy approach to deserialize my xml using XDocument!!!! 🙂 🙂

    Here is how I am doing it now

    var xDoc = XDocument.Parse(xmlString);
    XNamespace userNS = "http://www.webex.com/schemas/2002/06/service/user";
    XNamespace servNS = "http://www.webex.com/schemas/2002/06/service";
    var re = from rssItem in xDoc.Descendants(servNS + "bodyContent")
                     let elementTicket = rssItem.Element(userNS + "ticket")
                     let elementApiVersion = rssItem.Element(userNS + "apiVersion")
                     where (elementTicket != null && elementApiVersion != null)
                     select new getLoginTicketResponse()
                     {
                         ticket = elementTicket.Value,
                         apiVersion = elementApiVersion.Value
                     };
    
    getLoginTicketResponse loginTicketResponse = re.First();
    

    And I get my class object deserialized from the xml directly, no XSD nothing is required!

    Let me show you my xml here again

    <?xml version="1.0" encoding="iso-8859-1"?>
    <serv:message xmlns:serv="http://www.webex.com/schemas/2002/06/service"
    xmlns:com="http://www.webex.com/schemas/2002/06/common"
    xmlns:use="http://www.webex.com/schemas/2002/06/service/user">
        <serv:header>
            <serv:response>
                <serv:result>SUCCESS</serv:result>
                <serv:gsbStatus>BACKUP</serv:gsbStatus>
            </serv:response>
        </serv:header>
        <serv:body>
            <serv:bodyContent xsi:type="use:getLoginTicketResponse"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <use:ticket>5e9733eb9efeb02d80aa0551ef7e9ccd</use:ticket>
                <use:apiVersion>WebEx XML API V3.9.0</use:apiVersion>
            </serv:bodyContent>
        </serv:body>
    </serv:message>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file and I'm trying convert it into a (table( HTML
I have been trying to convert a web project that produces a war file
I'm trying convert all special chars into HTML safe entities on their way into
Trying to convert this c code into MIPS and run it in SPIM. int
im trying to convert a date format into a new format in this example
I am trying to serialize an xml to a class with the following way:
I'm trying convert xml from one format to other using the XslCompiledTransform in c#.
Is there an equivalent library for JAXB in .NET? I am trying to convert
Trying to convert this: HDC hdc = CreateCompatibleDC(NULL); HBITMAP cross = (HBITMAP)LoadImage(NULL, _(c:\\captureqwsx.bmp) ,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
Trying to convert a string to NSURL and this is not happening. barcodeTextLabel.text =

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.