• We've upgraded our forums. Please post any issues/requests in this thread.

Generate XML from XSD in Java

Joined
Jan 2, 2008
Messages
3,248 (0.89/day)
Likes
396
System Name Thakk
Processor i7 6700k @ 4.5Ghz
Motherboard Gigabyte G1 Z170N ITX
Cooling Deepcool Maelstrom 120k / H55
Memory 16GB Corsair LPX DDR4 2400
Video Card(s) GTX1080ti Founders Ed. AIO Cooled
Storage Corsair Force GT 120GB SSD / Intel 250GB SSD / Samsung Pro 512 SSD / 3TB Seagate SV32
Display(s) Acer Predator X34 100hz IPS Gsync / HTC Vive
Case Cougar QBX mini itx
Audio Device(s) Realtek ALC1150 > Creative Gigaworks T40 > AKG Q701
Power Supply Thermaltake 600w 140mm
Mouse Logitech G900
Keyboard Ducky Shine TKL MX Blue + Vortex PBT Doubleshots
Software Windows 10 64bit
Benchmark Scores http://www.3dmark.com/fs/12108888
#1
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:

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
17,072 (3.44/day)
Likes
17,990
Processor Core i7-4790K
Memory 16 GB
Video Card(s) GTX 1080
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 7
#2
xsd is the schema, xml contains the data conforming to that schema. how can you generate xml from xsd without data ?
 
Joined
Jan 2, 2008
Messages
3,248 (0.89/day)
Likes
396
System Name Thakk
Processor i7 6700k @ 4.5Ghz
Motherboard Gigabyte G1 Z170N ITX
Cooling Deepcool Maelstrom 120k / H55
Memory 16GB Corsair LPX DDR4 2400
Video Card(s) GTX1080ti Founders Ed. AIO Cooled
Storage Corsair Force GT 120GB SSD / Intel 250GB SSD / Samsung Pro 512 SSD / 3TB Seagate SV32
Display(s) Acer Predator X34 100hz IPS Gsync / HTC Vive
Case Cougar QBX mini itx
Audio Device(s) Realtek ALC1150 > Creative Gigaworks T40 > AKG Q701
Power Supply Thermaltake 600w 140mm
Mouse Logitech G900
Keyboard Ducky Shine TKL MX Blue + Vortex PBT Doubleshots
Software Windows 10 64bit
Benchmark Scores http://www.3dmark.com/fs/12108888
#3
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:
Joined
Nov 12, 2013
Messages
74 (0.05/day)
Likes
2
#4
In VS2010 if you load an XML file into the editor, click the XML menu >> Create Schema.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,927 (6.24/day)
Likes
10,025
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#5
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: