-2

I have used JAXB and Ant Script to convert XSD to Java classes. After that i have used Java to C# code converter tool. Below is one of the C# code from the generated with the comments

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Java.city") public class AdxpCity extends ADXP
public class JavaCity : Java
{


}

Should i convert commented @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Java.city") (or) Can i use above class as it is?

Scott Chamberlain
  • 124,994
  • 33
  • 282
  • 431
user4946187
  • 1
  • 1
  • 3

1 Answers1

3

The better thing to do is convert from XSD to C# directly via xsd.exe which gets installed with visual studio.

The most basic form would be

 xsd.exe yourFile.xsd /classes

however if you review the documentation you can customize further options like the default namespace the class will be generated inside.

There are also other 3rd party code generators listed in this SO question that have more features than xsd.exe, I have personally used xsd2Code and found it very good to use.

Community
  • 1
  • 1
Scott Chamberlain
  • 124,994
  • 33
  • 282
  • 431
  • I did try to locate xsd.exe but not able to locate this file to access. My machine was running with visual studio 2013. May i know where should i download and add this in VS 2013? – user4946187 Jun 25 '15 at 14:22
  • In the start menu click `Visual Studio Tools` this should open a folder, from there go to `Developer Command Prompt for VS2013` that should open a new console window. That console window should have `xsd.exe` included in its `PATH` variable so you can just type it from any folder and not need to include the full filepath of the program. The actual file can be found under ``C:\Program Files (x86)\Microsoft SDKs\Windows\v#.#A\bin\NETFX #.# Tools\`` folder (The `#`s will be replaced with a number on your system) – Scott Chamberlain Jun 25 '15 at 14:48