aspose file tools*
The moose likes Java in General and the fly likes Printing XML document in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Printing XML document in Java" Watch "Printing XML document in Java" New topic
Author

Printing XML document in Java

sailsjam
Greenhorn

Joined: Jul 05, 2001
Posts: 18
I am trying to print an XML document.I put the document on a JEditorPane but it has too many white space.It seems like JEditorPane doesnot know the XML format. What other way can I use to print the document.
Aj Manch
Ranch Hand

Joined: May 07, 2001
Posts: 50
If you are just interested in printing the XML document, you can open it in IE (I think 5 and above). IE already has a built-in parser and therefore formats it accordingly. You can print that out from there.
If that doesn't suffice your requirement, you can use XML4J or Xerces parser API to parse the XML document using Java and then you can do whatever you want.
Hope that helps.
AJ
bhuvan gupta
Greenhorn

Joined: Mar 26, 2001
Posts: 13
I think Object space dxml parser can be of better use for u here .... u can parse the XML string with the dxml parser and get the XML String back again using that .. the resulted XML String will be having proper indentation ...like XML being displayed in IE
Originally posted by Aj Manch:
If you are just interested in printing the XML document, you can open it in IE (I think 5 and above). IE already has a built-in parser and therefore formats it accordingly. You can print that out from there.
If that doesn't suffice your requirement, you can use XML4J or Xerces parser API to parse the XML document using Java and then you can do whatever you want.
Hope that helps.
AJ

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Printing XML document in Java