• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

How to select a particular element from xml doc having many elements

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am using DOM. I created an XML document by retrieving data from database and it contains more than 500 records.
Now I want to fetch data of particular record from xml doc.
How come it is possible using DOM
please help me if any one knows this
Thanking u
Saradhi
 
Sheriff
Posts: 6999
6
Eclipse IDE Debian Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"saradhi74",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
You have already been warned about the user name you have chosen. This name will soon be turned off, so please choose another name immediately.
Thanks.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I assume that there will be a primary key field in your XML structure so as to retrieve record on that basis.
Here's what you can do:
Var node
node = DOM.getElementsByTagName(Primary Key Tag Name)
for (int i=0;i<node.length;i++)
{
if(node.text = "The value for the record you want to retrieve" )
{
//Now you are on the desired record and can get the contents.
}
}
I hope this works.
Thanks.
Hemant
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can one select a particular element in case of SAX ? Is it possible to do it without loading the whole XML ?
 
You have to be odd to be #1 - Seuss. An odd little ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic