Solved

XML SAXBuilder printing Document

Posted on 2008-10-23
3
302 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

895 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

17 Experts available now in Live!

Get 1:1 Help Now