• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

without xml schema, generate java classes from xml data file ?

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
without xml schema, is it possible generate java classes from xml data file ? using which library ?

Thanks.
 
Ranch Hand
Posts: 479
1
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

An XML file can be converted into a class hierarchy using JAXB but am not sure if a schema definition is mandatory for the operation. In case there is a dependency on XSD for this operation you can approach the same using JAXP parsers and POJOs. You will have to have the code which uses SAX/DOM parser APIs, iterate through the elements and set the values for the properties in the hierarchy.

I you were to give more details on what you are trying to accomplish, I might be able to suggest further options available.

Cheers,
Raj.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Raj Kamal wrote:
An XML file can be converted into a class hierarchy using JAXB but am not sure if a schema definition is mandatory for the operation.



To work with JAXB one needs to have a schema. I don't think using JAXB one can generate classes from an XML document alone.
 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use XStream without XML schema file.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic