Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

how to create DOM structure from SAX parser

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Could you please tell me in detail that how to create DOM structure from SAX parser.

Like:
For a given XML file, a SAX parser is started parsing and that time retrieving the tag and their corresponsing value we have to create a DOM object or DOM object structure.

So in the time of SAX parsing and creating DOM structure How would we know who is the parent and who is the child for DOM object.

Regards,
Biswajit Paria
 
Biswajit Paria
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anyone please look into it?

Regards,
Biswajit Paria
 
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
Actually, DOM parsers alway use a SAX parser as input and constuct the DOM as the various SAX events arrive. Take a look at the Java source code to learn how it is done.

I don't understand what your problem "who is the parent" etc is. A DOM has a Document node containing all of the DOM data. Your first step should be to thoroughly understand the contents of the org.w3c.dom package - there is a great table in the javadocs for the Node interface that will help you understand the contents of a DOM.

Bill
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic