24

Is there an IDE out there that can generate XML from XSD? Not Oxygen or XmlSpy, they are too expensive for me... command line based is ofcourse the preferred method!

1

8 Answers 8

17

The Netbeans IDE has a wizard for generating XML documents from an XSD schema. A nice thing is that you can also ask it to generate optional and repeating elements too.

5
  • thank you, i love netbeans, didnt know this option :)
    – eddy147
    Jan 15, 2009 at 11:54
  • 6
    where is the menu located?
    – Louis Rhys
    Sep 30, 2011 at 10:44
  • 1
    IntelliJ also has support for doing this :) Feb 21, 2012 at 16:40
  • 3
    @Louis: stackoverflow.com/questions/7811715/…
    – eddy147
    Mar 13, 2012 at 7:31
  • I have tried many options for this and have found Oxygen to be the best. It is commercial but does offer a free trial. I have used this to generate XMLs from the most bloated schema ever: DDEX ERN and it worked great. The others couldn't do it.
    – sshaw
    Feb 5, 2022 at 17:29
9

You can do it in the Eclipse Web Tools (included in the Eclipse IDE for Java EE Developers).

2
7

How to generate sample XML documents from their DTD or XSD?

5

Note that soon after this answer was originally posted, Apache XMLBeans was retired. As such, I cannot recommend it anymore. Anyway, I am still of the opinion that it had good command line support for generating example xsd:s, but a new release haven't been done in well over 2 years at time of writing.


command line based is ofcourse the preferred method!

In my opinion xsd2inst in the Apache XMLBeans is a very good tool for this. It is command line based and ships with binaries for Windows and Unix/Linux.

It is really simple to use too:

xsd2inst schemafile.xsd -name globalElementName

It generates the output directly to the console and can of course easily be piped to a file.

Is there an IDE out there that can generate XML from XSD?

IntelliJ Idea has the same functionality if using an IDE is prefered, even in the community edition. Just right click inside the xsd document and select Generate Instance Document From Schema, then select the root node.

4
  • What program is IntelliJ using under the hood to generate it?
    – powder366
    Feb 19, 2017 at 17:57
  • @powder366 Good question. I don't actually know. The IntelliJ docuemtnation about this feature doesn't say which tool it uses either.
    – Magnilex
    Feb 19, 2017 at 19:11
  • It also doesn't really work, for me this functionality in IntelliJ always says "Root element name is invalid" whatever I try, "Ok" button remains inactive.
    – Czar
    Sep 24, 2018 at 11:34
  • @Czar It was a few years ago I answered this. It worked well then, for well formed xds:s. I haven't done it much since then though.
    – Magnilex
    Sep 24, 2018 at 19:03
1

The .NET XML transform classes are pretty easy to use, so if you can't find something, it would be pretty easy to whip together a simple command line utility to do what you want.

1

The free online XML editor XmlGrid.net has an option to generate XML from schema XSD. The nice thing is that you can specify how many repeatable elements you want and can fill the elements with the default values provided in your schema. It can handle very complicated schemas. Here is the url: http://xmlgrid.net

1
  • It doesn’t seem to work with my XSD. Opera, FF, Chrome, IE... Nothing happens; I just see several errors on the various console. Not very robust, apparently.
    – Martijn
    Feb 8, 2013 at 14:44
0

I used this link: i use c#. but this is a simple step. Load the xsd, generate xml. It generates a sample xml for and element 3 times. http://www.codeproject.com/Articles/400016/Generate-Sample-XML-from-XSD?msg=4279868

0

Useful online utility to Create XML Data From an XSD Schema File http://www.xsd2xml.com/

2

Not the answer you're looking for? Browse other questions tagged or ask your own question.