• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

Generate XML from XSD in Java

Joined
Jan 2, 2008
Messages
3,318 (0.52/day)
System Name Thakk
Processor 9800X3D
Motherboard MSI B650M Gaming Wifi
Cooling Id Cooling A410 + P12 Max 3300 RPM
Memory 32GB DDR5 6000 C30
Video Card(s) Zotac RTX3080 Trinity
Storage Crucial NVME 512 / Intel 250GB SSD / Samsung Pro 512 SSD / SanDIsk 1TB SSD / WD Black 6TB
Display(s) Acer Predator X34 100hz IPS Gsync
Case Generic mATX
Audio Device(s) Hyper X 7.1 USB Soundcard
Power Supply Corsair CV750 Bronze
Mouse Logitech G304
Keyboard Monsgeek MG75S Hall Effect + XDA Keycaps + Holee Mod
VR HMD HTC Vive
Software Windows
Benchmark Scores https://www.3dmark.com/3dm/123890762?
Hi,

I'd just want to know, if there is any library out there that has a method that generates an xml file from an xsd file automatically.

I plan to do this instead of creating an xml through code via dom4j's DocumentHelper and addElement(), addElement() shenanigans.
 
Last edited:
xsd is the schema, xml contains the data conforming to that schema. how can you generate xml from xsd without data ?
 
kind of like the one eclipse do, or other xml based tools like XMLSpy etc.. it fills the element value first with whatever the element name is or whatever restriction it already has.

I then plan to fill these with valid values up later down the path.. in this way, I wont recode the hard coded xml generation whenever there is a change in the structure.. just change the xsd schema with what the current format is.

In anycase, it looks like these apps that have auto generation looks like was made from the ground up.. just wanted to make sure if there was already an existing java library function before I make one myself.
 
Last edited:
In VS2010 if you load an XML file into the editor, click the XML menu >> Create Schema.
 
Visual Studio insists on having an XSD for all XML files to enforce compliance (as well as provide some autocompletion functionality). You should code XSD before creating subsequent XML files based on it.

You can grab Visual Studio Express for free (requires registration) if you want to use it for XML/XSD authoring.


Edit: My bad. I use DTD not schema.
 
Last edited:
Back
Top