• 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
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

XML parsing | SAX / STAX

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a simple question to ask regarding the xml parsing logic.
My requirement is that i will get an xml file with the feed data of the products. And i want to import it to my database.
For this i am using STAX api for xml parsing.
Now my question is, is there a way that i get a list of objects with all the parsed xml data in those objects.
I have generated Xsds from Xml and from Xsds I have generated java objects.
Now instead of doing that in the code to manually set all the values in the objects and then return the list of objects to the calling api,
i want to know if there is some api available that reads the XSDs and xml and returns me List<objects> with the data in those objects?


Thanks
 
Sheriff
Posts: 28346
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's a variety of Java-to-XML binding tools, yes. Some of them work based on schemas but it's not necessarily a requirement. I don't know if they will work with Stax parsers -- but why is that a requirement?
 
Gurvinder Singh
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The requirement is that i have a pretty complex xml structure that may change in the future.
So to save time from coding again, we want that the xml be parsed and the list of value objects be returned and we use them directly.
If this can be done via any other xml parsing api other than STAX then please suggest.
 
Paul Clapham
Sheriff
Posts: 28346
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You still haven't said why you are focusing on a choice of parsers. That's all backwards. You should first be looking at those Java-to-XML binding tools and deciding which one fits your requirements.
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic