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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Parse Multiple Xml files with different structure

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
My Question is, i have two more xml files with different structure how i able parse that all single unit in servlets and also i send parsed xml data into client side based on its request please help me with sample code or any links
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
You parse the first XML, then you parse the second XML. I don't see why it's a problem that the two XML documents have a different structure; you'd just have to write different code to parse them. Could you explain a bit more about why you are having a problem with this?
 
Durga Roobini
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
if have 50 xml file means 50 times I want to parse it ha? instead I want to parse it once,here I want to access third party api eg like(Eventful,eventbrite) which are getting events based on location,date etc.i have two xml files from events site I have parse once in servlet it should be generic.
 
Durga Roobini
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I clearly tell my problem



Third party webservices (eventful,eventbrite,etc) ->{xml response} -> Server (serlvets) (parse all events at only once it should be generic) <->{request,response} -> Client(jsp,phonegap,smart tv etc)
 
Rancher
Posts: 989
9
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Durga Roobini wrote: if have 50 xml file means 50 times I want to parse it ha? instead I want to parse it once,here I want to access third party api eg like(Eventful,eventbrite) which are getting events based on location,date etc.i have two xml files from events site I have parse once in servlet it should be generic.



You are not making much sense here.
How many files do you want to parse? 50 or 2?
Do you have XSDs for those XML files?
Why do you want to parse those files? Are you just looking for certain values from them or do you have to read all the data in the files? What are you going to do with the data that you are reading from the files?
Forget about servlets for now. Parse the files in normal Java classes. You can then call those classes from the servlet.
What have you tried and where exactly are you stuck?
 
Durga Roobini
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I want to add xml file dynamically more than parsed xml could be generic
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
If the XML files have different structure, then you need different code for handling them.
 
Durga Roobini
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Give some idea or samples to implement this one
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
You already posted code for handling one server and its response in some other thread; what prevents you from doing that 3 times? (And maybe afterwards factoring out common parts into their own methods.)
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Closing this one, since the topic starter already created another thread for discussing this same thing https://coderanch.com/t/626438/XML/Multiple-URL-access.

Durga, like you have been told before, please do not create multiple threads for the same questions.
 
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic