Solved

XML SAXBuilder printing Document

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
factorial example 4 41
read an xml file in perl 2 33
How  Can  I  resolve   this  Error "java.sql.SQLException: Invalid column index" 4 39
write xml in vb.net 2 24
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

821 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