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

XML query

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

I just started learning about XML, in my company we need to store details about books in xml file.
<books>
<book id ='12',bookName='xml'></book>
</books>

1) we need to some times query this xml file, right now I am reading an entire file and verifying the book id to identify the one I want to show.
Is there any way to make this process easier?

2)Some time I need to update an existing book data too, so if you could let me know to do this 'right' way and tutorials that would be great.

Thanks,
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) we need to some times query this xml file, right now I am reading an entire file and verifying the book id to identify the one I want to show.
Is there any way to make this process easier?

Well, there's no easy answer to this question. A lot depends on what this books file contains. It depends on how large this file is, how frequently you need to search (very frequent I would imagine), how frequently you should update (not so frequent?). Things of this nature. Each application has its set of challenges.

A lot of these questions can only be answered by your organization. Hence, there is no (generic) ONE answer.

2)Some time I need to update an existing book data too, so if you could let me know to do this 'right' way and tutorials that would be great.

The 'right' way to update can not be known before you have an answer to your first question.

Since you already seem to have a solution, if you could tell us what parser (if at all) you are using then someone could comment on the 'right' way.
Thanks.

- m
 
marys joseph
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply.

books file contains details abotu books
Structure of the xml file is
<books>
<book id='',name='',productdescription='',price=''></book>
</books>

We have more than 50 books in the file. When user tried to update the books info we do update the file, this may happen atleast 5 times when user opens up the application.

Right now I read all the nodes and check the book id to get the node and update it.

hope i gave all the information.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that there is an attempt to standardaze an XMLquery language. You should be able to find lots of related examples and code.
Bill
 
This is my favorite tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic