Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8071703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:46:25+00:00 2026-06-05T13:46:25+00:00

I am trying to accomplish the following: load a document (done) go trough the

  • 0

I am trying to accomplish the following:

  1. load a document (done)
  2. go trough the document depth first and use a DefaultHandler from JDK to do some work

The reason I want to do this is that I already have my handler, and now I am using it with a SAX parser. I now want to use the handler on the in-memory document.

Note that this is useful in the following way: I have to use the handler multiple times. For large documents I want to use SAX, for small I want to use the internal representation.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:46:26+00:00Added an answer on June 5, 2026 at 1:46 pm

    The quickest way (quick in coding) to accomplish this is to write the portion of the internal document that you wish to parse with SAX into an internal string, and then using a StringReader based on that string, pass that to a SAX parser using your handler.

    What you really need is to generate SAX events based on your data and feed those events to the handler. You can do that by getting the data into the form of an InputSource or Reader and then using that in your parse, which is the tactic described above, or you can simply simulate the SAX events by directly calling the methods of the ContentHandler you’ve already written. But calling them in the right order and feeding them the right data to accomplish what you need may be painful if your document is at all complex.

    If Dom4J provides a way to create an InputSource based on a node in your document structure, that will be the easiest to use, and likely much more efficient than writing it to a string first.

    You might better consider extracting the portions of your ContentHandler that do the actual work into a separate class that you can use both from the ContentHandler and from a new class that walks the internal tree.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some trouble trying to figure out, how to accomplish the following.
I'm trying to accomplish the following: Have a thread that reads data from a
I am trying to accomplish the following: SELECT col1, col2 FROM table1 UNION SELECT
I am trying to work though the best approach to accomplish the following. Within
I am trying to accomplish the following. I need to use Drupal 6 as
I am trying to accomplish the following logical operation in Python but getting into
I'm trying to accomplish the following in ASP.Net: Create a WPF Canvas control Spin
I am trying to accomplish the following: 1. On click, have a div with
I'm trying to accomplish the following layout, http://www.rae-mx.com/test/css-layout.jpg and I'm almost there, except for
I'm trying to accomplish the following using CSS: <table border=1 width=300px> <tr> <td rowspan=2>This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.