Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing XML document in Java

 
sailsjam
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic