• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Generate XML from XSD in Java

Joined
Jan 2, 2008
Messages
3,296 (0.55/day)
System Name Thakk
Processor i7 6700k @ 4.5Ghz
Motherboard Gigabyte G1 Z170N ITX
Cooling H55 AIO
Memory 32GB DDR4 3100 c16
Video Card(s) Zotac RTX3080 Trinity
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 QBX
Audio Device(s) Realtek ALC1150 > Creative Gigaworks T40 > AKG Q701
Power Supply Corsair SF600
Mouse Logitech G900
Keyboard Ducky Shine TKL MX Blue + Vortex PBT Doubleshots
Software Windows 10 64bit
Benchmark Scores http://www.3dmark.com/fs/12108888
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
27,037 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
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,296 (0.55/day)
System Name Thakk
Processor i7 6700k @ 4.5Ghz
Motherboard Gigabyte G1 Z170N ITX
Cooling H55 AIO
Memory 32GB DDR4 3100 c16
Video Card(s) Zotac RTX3080 Trinity
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 QBX
Audio Device(s) Realtek ALC1150 > Creative Gigaworks T40 > AKG Q701
Power Supply Corsair SF600
Mouse Logitech G900
Keyboard Ducky Shine TKL MX Blue + Vortex PBT Doubleshots
Software Windows 10 64bit
Benchmark Scores http://www.3dmark.com/fs/12108888
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.02/day)
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
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
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:
Top