Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

XML SAXBuilder printing Document

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
chima
Asked:
chima
  • 2
1 Solution
 
chimaAuthor Commented:
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
 
contactkarthiCommented:
in org.jdom.output.XMLOutputter there is an option to print the Document object as xml string

XMLOutputter.outputString(schemaDoc)



0
 
chimaAuthor Commented:
Worked like a charm, thanks
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now