Solved

XML SAXBuilder printing Document

Posted on 2008-10-23
3
292 Views
Last Modified: 2013-12-15
Hello, This is a SAXBuilder builder.build document; Document schemaDoc = builder.build(schemaURL);
I would like to see the content of the schemaDoc.  What would be the code that would allow me to print the text.
I tried looking at the popup window (nodes) and THAT IS NOT THE WAY TO FIND ANY OF THE CONTEXT!.
thanks
0
Comment
Question by:chima
  • 2
3 Comments
 

Author Comment

by:chima
ID: 22792033
Should the attached code snippet work for the schemaDoc?
I get DOM Document:[#document: null]

Earlier I had been looking at the schemaDoc, via the popup window and did see a text line that is several lines within the xml file.  So this gave me the confidence that the xml file is being read.
Document schemaDoc = builder.build(schemaURL);
 

//            Need to print/view the content of schemaDoc

            DOMOutputter domOutPutter = new DOMOutputter();

            System.out.print("\n DOM Document:" + domOutPutter.output(schemaDoc));

            System.out.print("\n Schema Doc:" + schemaDoc.getDocument());

Open in new window

0
 
LVL 17

Accepted Solution

by:
contactkarthi earned 500 total points
ID: 22797372
in org.jdom.output.XMLOutputter there is an option to print the Document object as xml string

XMLOutputter.outputString(schemaDoc)



0
 

Author Closing Comment

by:chima
ID: 31509471
Worked like a charm, thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now