Quantcast
Channel: xsd2Code community edition .net class generator from XSD schema
Viewing all 543 articles
Browse latest View live

Updated Wiki: Home

$
0
0

Project Description
Xsd2Code community edition is a CSharp or Visual Basic Business Entity class Generator from XSD schema.


 What Xsd2Code community edition can do ?

  • Generate CS, VB code from xsd schema.
  • Generate partial class.
  • Support generic and custom collection (List<T>, ObservableCollection<T>, MyCustomCollection<T>).
  • Support automatic properties when no special get or set is required.
  • Can generate WCF attributes (DataContract/DataMember).
  • Implement INotifyPropertyChanged for enable DataBinding.
  • Generate summary documentation from xsd annotation.
  • Save and load Xml document into isolated file storage for silverlight app.
  • Read an write xml with UTF-8/32, ASCII, Unicode, Default.
  • Save and load from XML file.

xsd2code is available as dual-licensing.

  • xsd2code++ (www.xsd2code.com)
    Paid version with additional features for developers and business customers working on commercial projects.
  • xsd2code community edition (here on codeplex)
    Free version for individual developers working on personal or open source projects. 

 

How to use it ?

Xsd2Code community edition is an AddIn for visual studio 2008.
Right clic on xsd schema in solution explorer, choose options and generate code.

AddinMenu.jpg

propertyGrid.png

Enable databinding.

<xs:elementname="show"type="xs:boolean"nillable="true"/>


Result :

        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]public System.Nullable<bool> show {get {returnthis.showField;
            }set {if ((showField.Equals(value) != true)) {this.showField = value;
                    OnPropertyChanged("show");
                }
            }
        }publicevent System.ComponentModel.PropertyChangedEventHandler PropertyChanged;privatevoid OnPropertyChanged(string info) {
            PropertyChangedEventHandler handler = PropertyChanged;if (handler != null) {
                handler(this, new PropertyChangedEventArgs(info));
            }
        }

 

Hide private field in Visual studio.

     [EditorBrowsable(EditorBrowsableState.Never)]private List <dvds> dvdsField;

Generic collection.

<xs:elementname="Product">
    <xs:complexType>
      <xs:sequencemaxOccurs="unbounded">
        <xs:elementname="ProductName"type="xs:string"/>
        <xs:elementname="ProductVersion"type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
</xs:element>


Result :

///<summary>/// .ctor class constructor///</summary>public Product() {if ((this.productVersionField == null)) {this.productVersionField = new List<System.String>();
            }if ((this.productNameField == null)) {this.productNameField = new List<System.String>();
            }
        }///<remarks/>
        [System.Xml.Serialization.XmlElementAttribute("ProductName")]public List<System.String> ProductName {get {returnthis.productNameField;
            }set {if ((this.productNameField != null)) {if ((productNameField.Equals(value) != true)) {this.productNameField = value;
                        OnPropertyChanged("ProductName");
                    }
                }else {this.productNameField = value;
                    OnPropertyChanged("ProductName");
                }
            }
        }

Lazy loading pattern.

        [System.Xml.Serialization.XmlElementAttribute("Dvds")]public List<dvd> Dvds {get {if ((this.dvdsField == null)) {this.dvdsField = new List<dvd>();
                }returnthis.dvdsField;
            }set {this.dvdsField = value;
            }
        }

Serialize/Deserialize XML.

///<summary>/// Serializes current EntityBase object into an XML document///</summary>// <returns>string XML value</returns>publicvirtualstring Serialize() {
            System.IO.StreamReader streamReader = null;
            System.IO.MemoryStream memoryStream = null;try {
                memoryStream = new System.IO.MemoryStream();
                Serializer.Serialize(memoryStream, this);
                memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
                streamReader = new System.IO.StreamReader(memoryStream);return streamReader.ReadToEnd();
            }finally {if (streamReader != null) {
                    streamReader.Dispose();
                }if (memoryStream != null) {
                    memoryStream.Dispose();
                }
            }
        }///<summary>/// Deserializes workflow markup into an EntityBase object///</summary>// <param name="xml">string workflow markup to deserialize</param>// <param name="obj">Output EntityBase object</param>// <param name="exception">output Exception value if deserialize failed</param>// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>publicstaticbool Deserialize(string xml, out T obj, out System.Exception exception) {
            exception = null;
            obj = default(T);try {
                obj = Deserialize(xml);returntrue;
            }catch (System.Exception ex) {
                exception = ex;returnfalse;
            }
        }publicstaticbool Deserialize(string xml, out T obj) {
            System.Exception exception = null;return Deserialize(xml, out obj, out exception);
        }publicstatic T Deserialize(string xml) {
            System.IO.StringReader stringReader = null;try {
                stringReader = new System.IO.StringReader(xml);return ((T)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader))));
            }finally {if (stringReader != null) {
                    stringReader.Dispose();
                }
            }
        }

SaveToFile and LoadFromFile method.

///<summary>/// Serializes current EntityBase object into file///</summary>// <param name="fileName">full path of outupt xml file</param>// <param name="exception">output Exception value if failed</param>// <returns>true if can serialize and save into file; otherwise, false</returns>publicvirtualbool SaveToFile(string fileName, out System.Exception exception) {
            exception = null;try {
                SaveToFile(fileName);returntrue;
            }catch (System.Exception e) {
                exception = e;returnfalse;
            }
        }publicvirtualvoid SaveToFile(string fileName) {
            System.IO.StreamWriter streamWriter = null;try {string xmlString = Serialize();
                System.IO.FileInfo xmlFile = new System.IO.FileInfo(fileName);
                streamWriter = xmlFile.CreateText();
                streamWriter.WriteLine(xmlString);
                streamWriter.Close();
            }finally {if (streamWriter != null) {
                    streamWriter.Dispose();
                }
            }
        }///<summary>/// Deserializes workflow markup from file into an EntityBase object///</summary>// <param name="xml">string workflow markup to deserialize</param>// <param name="obj">Output EntityBase object</param>// <param name="exception">output Exception value if deserialize failed</param>// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>publicstaticbool LoadFromFile(string fileName, out T obj, out System.Exception exception) {
            exception = null;
            obj = default(T);try {
                obj = LoadFromFile(fileName);returntrue;
            }catch (System.Exception ex) {
                exception = ex;returnfalse;
            }
        }publicstaticbool LoadFromFile(string fileName, out T obj) {
            System.Exception exception = null;return LoadFromFile(fileName, out obj, out exception);
        }publicstatic T LoadFromFile(string fileName) {
            System.IO.FileStream file = null;
            System.IO.StreamReader sr = null;try {
                file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read);
                sr = new System.IO.StreamReader(file);string xmlString = sr.ReadToEnd();
                sr.Close();
                file.Close();return Deserialize(xmlString);
            }finally {if (file != null) {
                    file.Dispose();
                }if (sr != null) {
                    sr.Dispose();
                }
            }
        }

Default value.

<xs:attributename="nationality"type="xs:string"default="US">


Result :

///<summary>/// .ctor class constructor///</summary>public Actor() {this.nationalityField = "US";
        }

Code xml comment.

<xs:elementname="firstname"type="xs:string"><xs:annotation><xs:documentation>
        Gets or sets the firstname of the actor</xs:documentation></xs:annotation></xs:element>


Result :

///<summary>/// Gets or sets the firstname of the actor///</summary>publicstring firstname {get;set;}

Backup options generation in cs or vb header

// ------------------------------------------------------------------------------//  <auto-generated>//    Generated by Xsd2Code. Version 2.1.3148.17485//   <NameSpace>XSD2Code.Test</NameSpace><Collection>List</Collection>...//  <auto-generated>// ------------------------------------------------------------------------------namespace XSD2Code.Test {using System;using System.Diagnostics;
    ...

New Post: Output File locaion in Visual Studio

$
0
0
In my Visual Studio project I have links to XSD files. When I right-click on the XSD to run XSD 2 Code Generation it defaults to writing the code in the same link path as the XSD. I would recommend adding the source output folder to the list of properties that can be set. It would be preferable if this output folder supported VS path macros too. this would allow me to have a link to the XSD, but route the generated source file to a preferred directory within my project.

Released: xsd2code community edition 3.4 (Nov 10, 2013)

Updated Release: xsd2code community edition 3.4 (nov. 10, 2013)

Source code checked in, #108159

New Post: "Invalid license" error on fresh install

$
0
0
I just installed Xsd2Code in order to generate some .cs classes from an .xsd file I've got.

I ran the following at the command line:
xsd2code ogckml22.xsd
and got the following message:
Xsd2Code Version 4.0.0.285
Copyright (c) Pascal Cabanel.  All rights reserved.
Code generation utility from XML schema files.

Invalid or expired license
Invalid license
I realize that there are two versions of Xsd2Code: a community edition, and Xsd2Code++. I first downloaded Xsd2Code++ from http://www.xsd2code.com/ but realizing my mistake I then downloaded the community edition from this CodePlex site. I am still getting the above error.

Any idea what could be wrong?

New Post: "Invalid license" error on fresh install

$
0
0
I uninstalled both Xsd2Code and Xsd2Code++, and then reinstalled just the community edition. It looks like the problem is solved.

Should have tried that before posting :)

Created Unassigned: Different Licences [16839]

$
0
0
Hello together;

On your website https://xsd2code.codeplex.com Register "HOME" you say the license of the community edition is for private and opensource project's only.
When we look at the register "LICENSE" then it is MIT-License, what is quite different.

Which one is it now ?

greetings
Klaus

Released: xsd2code community edition 3.4 (Nov 10, 2013)

Updated Release: xsd2code community edition 3.4 (nov. 10, 2013)

Commented Issue: annotations as comments [11556]

$
0
0
Not sure how possible this is, but schma annotations imported as code comments would be nice (unless i missed this setting somewhere).
Comments: ** Comment from web user: lucianoc **

Is this item really closed? I'm getting same behavior. The generated code do not have summary for classes or properties.

New Post: Text message marketing: Be proactive

$
0
0
Imagine if you will that someone has stolen your identity. How would you like to learn of it? In the first scenario, your credit card company notices some suspicious behavior with your account and sends you a text asking if you know about the recent charges. The problem is caught early and solved. In the second scenario, you only become aware of the suspicious behavior several days later when you check your balance online. You contact the credit card company and have them cancel your card.

Most likely, you would prefer the fairst scenario over the second one. That's because in the first, your credit card acted proactively to solve a problem. In the second, your credit card company's response was reactive.

This example highlights an important truth about text message marketing: customers prefer a proactive approach.

Why customers like proactive marketing

According to the field of social psychology, everyone has a need to be liked. The reason most of us would prefer the first scenario above is that the credit card company made us feel valued and important. When a credit card company, or any other business for that matter, handles a situation proactively instead of reactively, it makes our lives easier. Rather than waiting for us to contact them when there's a problem, they reach out and fix our problem sometimes before we realize there is one. It's much easier to trust a business when they take the proactive approach.

Why businesses like proactive marketing

Customers aren't the only ones who appreciate proactive marketing strategies. Companies like them too. For one, they reap the benefits of having satisfied customers as a result of their proactive approach. But even more importantly, a proactive approach gives a business the ability to take charge of a situation. When a problem arises, a proactive approach involves taking charge and fixing it. A reactive approach involves waiting around for the problem to go away or for someone else to solve it. A proactive approach gives a business control over their situation, a reactive approach does the opposite.

The key to proactive SMS marketing

When it comes to SMS marketing, there are a number of ways to be proactive. It's not a strategy limited to credit card companies and banks. The goal is to use text messages to handle problems and make customers' lives easier. To maximize the effectiveness of SMS marketing, businesses need to think about how texting can be used to benefit customers. Don't make it all about advertising and making profit. Make it about satisfying customers and the success will come.


Mobile Technology News brought to you by businesstexter.com
Source: http://www.business2community.com/marketing/proactive-marketing-strategies-effective-0876834#!NM5OJ

Created Unassigned: XSD2Code on VS2010 Problems running [16860]

$
0
0
How can i get XSD2Code to run on Windows 7 with Visual Studio 2010.

I tried a reinstall, and connecting the path in VS2010.
Checked the add-in manager
Checked the security
Checked the customize of the toolbar.

And still is does appear to be available

Does anyone have a Clue?

New Post: Cannnot load from XML to class

$
0
0
maurelio wrote:
the Italian autority has published xsd format for elettronic invoice circularity

I have tried to generate c# class with official xsd but I xsd2Code fails with an error : "the http://www.w3.org/2000/09/xmldsig# signature element is not declared " this is an xsd import section
.
Io ho risolto il problema eliminando l'elemento
<xs:element minOccurs="0" ref="ds:Signature"/>
Dopo aver eliminato tale elemento le classi sono state generate regolarmente, ma non so se ho fatto bene.
Che dite?

New Post: Cannnot load from XML to class

$
0
0
Controllando gli esempi xml su fatturapa.gov.it ho visto che ds:Signature viene utilizzato solo dalla fattura in formato xml firmato XAdES-BES.

Quindi penso che se non si utilizza quel formato il ds:Signature possa essere ignorato, come hai fatto tu, ma non sono esperto di xml, sto cercando anche io di capire che strada prendere.

se hai informazioni in merito postale qui. grazie...

Commented Unassigned: Different Licences [16839]

$
0
0
Hello together;

On your website https://xsd2code.codeplex.com Register "HOME" you say the license of the community edition is for private and opensource project's only.
When we look at the register "LICENSE" then it is MIT-License, what is quite different.

Which one is it now ?

greetings
Klaus
Comments: ** Comment from web user: aplocher **

Can't host on Codeplex under those terms either.

New Post: How Insurance Companies are Benefitting from Mobile Marketing

$
0
0
Companies of all sorts are seeing great success from mobile marketing. As technology advances, there are more and more ways to reach the mobile market and it is up to the companies to come up with creative mobile marketing ideas to keep their consumers interested. It is important that companies focus on the needs and wants of their consumers if they want to see success through mobile marketing, and there are several companies who have already figured out how to do just that. According to Mobile Marketer, Allstate, the insurance company, has come up with a new interactive marketing application that has been welcomed with open arms by their current customers as well as brought in a wave of new customers. Not only does Allstate’s new app greatly benefit their consumers, it also benefits the company by making it easier to monitor policy holders.

You might be wondering why consumers would want an app that records their driving behavior, but Allstate has discovered that consumers like this idea because they can receive discounts and other benefits (primarily lower premiums) by showing they good driving habits. Parents of teen drivers also appreciate the app because it allows them to monitor their driving habits as well as set specific limits to their driving. Once those limits are broken, the application sends notifications to the parents keeping them informed. Allstate has discovered that because consumers are aware that their driving habits are being monitored, they are also more responsible drivers making the roads a safer place in the long run. Another great feature of the application is when consumers have questions they are able to receive real-time feedback from their agents, an incentive that draws in much business in and of itself.

Focusing on the consumers

Interactive applications that reward the consumers, such as the one Allstate has created, are a great way to promote business as well as keep track of data in order to improve business. Up until this point, the only way insurance companies could monitor their policy holders was either by trusting the word of the policy holders, or installing a complicated device onto the car. Not only is this tedious, it is also costly to the consumer. Allstate’s interactive application is completely free to the consumer, and ultimately saves the business money in the long run. The most important part of mobile marketing for consumers is the convenience that comes with it. If interactive applications are difficult and tedious to use, consumers will not waste their time with them. If companies want to find success through mobile marketing, they must keep it simple as well as cater to the wants and needs of their consumers.


Mobile Technology News brought to you by businesstexter.com

Source: mobilemarketer.com/cms/news/software-technology/18031.html

New Post: XMLDSig Issue

$
0
0
Hi
We have been using xsd2code a bit. No however we have an updated Schema where they included xmldsig data.
However the xsd2code Visual Studio extension fails with a message saying "Signature" is not defined, even though the .xsd file is correctly imported in the namespace.

Any suggestion on this, or does xsd2code just not support xmldsig?

Created Unassigned: XML Deserialization [16904]

$
0
0
Hello,

I used Xsd2Code version 3.4.0.38967 in order to generate a Xml Serialize / Deserialize model for an xml file.

Sometimes the code works fine, sometimes the following error is reported at the deserialization process : "Error in Xml Document (0,0) : Root element not found ".

This is the generated code :

```
LoadMethod()
{
System.IO.FileStream file = null;

System.IO.StreamReader sr = null;
try
{
file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read);
sr = new System.IO.StreamReader(file);
string xmlString = sr.ReadToEnd();
sr.Close();
file.Close();
return Deserialize(xmlString);
}
finally{
if ((file != null))
{
file.Dispose();
}
if ((sr != null))
{
sr.Dispose();
}
}
}

public static LocaleElement Deserialize(string xml)
{
System.IO.StringReader stringReader = null;
try
{
stringReader = new System.IO.StringReader(xml);
// here the exception is reported !!!!
return ((LocaleElement)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader))));
}
finally
{
if ((stringReader != null))
{
stringReader.Dispose();
}
}
}

private static System.Xml.Serialization.XmlSerializer Serializer
{
get
{
if ((serializer == null))
{
serializer = new System.Xml.Serialization.XmlSerializer(typeof(TextStyleCategory));
}
return serializer;
}
}
```

After some research i detected that this problem comes because the Deserialize method does not find the stream in a valid position and cannot read from it . However i had not found any reference that XmlReader.Create(stringReader) does this thing.

I changed the code for the deserialize method with the following :

```
public static TextStyleConf Deserialize(string xml)
{
System.IO.StringReader stringReader = null;

try
{
stringReader = new System.IO.StringReader(xml);

return (LocaleElement)(Serializer.Deserialize(stringReader));
}
finally
{
if (stringReader != null)
{
stringReader.Dispose();
}
}
}
```

This does not reports the problem anymore....however i don't know exactly if this is a good solution. I would like to receive a second opinion on the matter. Thank you

Updated Wiki: Home

$
0
0

Project Description
Xsd2Code community edition is a CSharp or Visual Basic Business Entity class Generator from XSD schema.


 What Xsd2Code community edition can do ?

  • Generate CS, VB code from xsd schema.
  • Generate partial class.
  • Support generic and custom collection (List<T>, ObservableCollection<T>, MyCustomCollection<T>).
  • Support automatic properties when no special get or set is required.
  • Can generate WCF attributes (DataContract/DataMember).
  • Implement INotifyPropertyChanged for enable DataBinding.
  • Generate summary documentation from xsd annotation.
  • Save and load Xml document into isolated file storage for silverlight app.
  • Read an write xml with UTF-8/32, ASCII, Unicode, Default.
  • Save and load from XML file.

xsd2code is available as dual-licensing.

  • xsd2code++ (www.xsd2code.com)
    Paid version with additional features for developers and business customers working on commercial projects.
  • xsd2code community edition (here on codeplex)

 

How to use it ?

Xsd2Code community edition is an AddIn for visual studio 2008.
Right clic on xsd schema in solution explorer, choose options and generate code.

AddinMenu.jpg

propertyGrid.png

Enable databinding.

<xs:elementname="show"type="xs:boolean"nillable="true"/>


Result :

        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]public System.Nullable<bool> show {get {returnthis.showField;
            }set {if ((showField.Equals(value) != true)) {this.showField = value;
                    OnPropertyChanged("show");
                }
            }
        }publicevent System.ComponentModel.PropertyChangedEventHandler PropertyChanged;privatevoid OnPropertyChanged(string info) {
            PropertyChangedEventHandler handler = PropertyChanged;if (handler != null) {
                handler(this, new PropertyChangedEventArgs(info));
            }
        }

 

Hide private field in Visual studio.

     [EditorBrowsable(EditorBrowsableState.Never)]private List <dvds> dvdsField;

Generic collection.

<xs:elementname="Product">
    <xs:complexType>
      <xs:sequencemaxOccurs="unbounded">
        <xs:elementname="ProductName"type="xs:string"/>
        <xs:elementname="ProductVersion"type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
</xs:element>


Result :

///<summary>/// .ctor class constructor///</summary>public Product() {if ((this.productVersionField == null)) {this.productVersionField = new List<System.String>();
            }if ((this.productNameField == null)) {this.productNameField = new List<System.String>();
            }
        }///<remarks/>
        [System.Xml.Serialization.XmlElementAttribute("ProductName")]public List<System.String> ProductName {get {returnthis.productNameField;
            }set {if ((this.productNameField != null)) {if ((productNameField.Equals(value) != true)) {this.productNameField = value;
                        OnPropertyChanged("ProductName");
                    }
                }else {this.productNameField = value;
                    OnPropertyChanged("ProductName");
                }
            }
        }

Lazy loading pattern.

        [System.Xml.Serialization.XmlElementAttribute("Dvds")]public List<dvd> Dvds {get {if ((this.dvdsField == null)) {this.dvdsField = new List<dvd>();
                }returnthis.dvdsField;
            }set {this.dvdsField = value;
            }
        }

Serialize/Deserialize XML.

///<summary>/// Serializes current EntityBase object into an XML document///</summary>// <returns>string XML value</returns>publicvirtualstring Serialize() {
            System.IO.StreamReader streamReader = null;
            System.IO.MemoryStream memoryStream = null;try {
                memoryStream = new System.IO.MemoryStream();
                Serializer.Serialize(memoryStream, this);
                memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
                streamReader = new System.IO.StreamReader(memoryStream);return streamReader.ReadToEnd();
            }finally {if (streamReader != null) {
                    streamReader.Dispose();
                }if (memoryStream != null) {
                    memoryStream.Dispose();
                }
            }
        }///<summary>/// Deserializes workflow markup into an EntityBase object///</summary>// <param name="xml">string workflow markup to deserialize</param>// <param name="obj">Output EntityBase object</param>// <param name="exception">output Exception value if deserialize failed</param>// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>publicstaticbool Deserialize(string xml, out T obj, out System.Exception exception) {
            exception = null;
            obj = default(T);try {
                obj = Deserialize(xml);returntrue;
            }catch (System.Exception ex) {
                exception = ex;returnfalse;
            }
        }publicstaticbool Deserialize(string xml, out T obj) {
            System.Exception exception = null;return Deserialize(xml, out obj, out exception);
        }publicstatic T Deserialize(string xml) {
            System.IO.StringReader stringReader = null;try {
                stringReader = new System.IO.StringReader(xml);return ((T)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader))));
            }finally {if (stringReader != null) {
                    stringReader.Dispose();
                }
            }
        }

SaveToFile and LoadFromFile method.

///<summary>/// Serializes current EntityBase object into file///</summary>// <param name="fileName">full path of outupt xml file</param>// <param name="exception">output Exception value if failed</param>// <returns>true if can serialize and save into file; otherwise, false</returns>publicvirtualbool SaveToFile(string fileName, out System.Exception exception) {
            exception = null;try {
                SaveToFile(fileName);returntrue;
            }catch (System.Exception e) {
                exception = e;returnfalse;
            }
        }publicvirtualvoid SaveToFile(string fileName) {
            System.IO.StreamWriter streamWriter = null;try {string xmlString = Serialize();
                System.IO.FileInfo xmlFile = new System.IO.FileInfo(fileName);
                streamWriter = xmlFile.CreateText();
                streamWriter.WriteLine(xmlString);
                streamWriter.Close();
            }finally {if (streamWriter != null) {
                    streamWriter.Dispose();
                }
            }
        }///<summary>/// Deserializes workflow markup from file into an EntityBase object///</summary>// <param name="xml">string workflow markup to deserialize</param>// <param name="obj">Output EntityBase object</param>// <param name="exception">output Exception value if deserialize failed</param>// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>publicstaticbool LoadFromFile(string fileName, out T obj, out System.Exception exception) {
            exception = null;
            obj = default(T);try {
                obj = LoadFromFile(fileName);returntrue;
            }catch (System.Exception ex) {
                exception = ex;returnfalse;
            }
        }publicstaticbool LoadFromFile(string fileName, out T obj) {
            System.Exception exception = null;return LoadFromFile(fileName, out obj, out exception);
        }publicstatic T LoadFromFile(string fileName) {
            System.IO.FileStream file = null;
            System.IO.StreamReader sr = null;try {
                file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read);
                sr = new System.IO.StreamReader(file);string xmlString = sr.ReadToEnd();
                sr.Close();
                file.Close();return Deserialize(xmlString);
            }finally {if (file != null) {
                    file.Dispose();
                }if (sr != null) {
                    sr.Dispose();
                }
            }
        }

Default value.

<xs:attributename="nationality"type="xs:string"default="US">


Result :

///<summary>/// .ctor class constructor///</summary>public Actor() {this.nationalityField = "US";
        }

Code xml comment.

<xs:elementname="firstname"type="xs:string"><xs:annotation><xs:documentation>
        Gets or sets the firstname of the actor</xs:documentation></xs:annotation></xs:element>


Result :

///<summary>/// Gets or sets the firstname of the actor///</summary>publicstring firstname {get;set;}

Backup options generation in cs or vb header

// ------------------------------------------------------------------------------//  <auto-generated>//    Generated by Xsd2Code. Version 2.1.3148.17485//   <NameSpace>XSD2Code.Test</NameSpace><Collection>List</Collection>...//  <auto-generated>// ------------------------------------------------------------------------------namespace XSD2Code.Test {using System;using System.Diagnostics;
    ...
Viewing all 543 articles
Browse latest View live