• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can anybody help me why this code returning the null value  RSS feed

 
koti kotes
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Santhosh ayiappan
Ranch Hand
Posts: 81
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need to convert the Document object to String, you need to use "StringWriter" & "StreamResult"

Regards
Santhosh
 
Vinod Vijay
Ranch Hand
Posts: 165
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
koti kotes wrote:String fileRequestInput = "D:/INTEGRATION_SERVICES/IDENTITY_MANAGEMENT/Automation/DataBank/WS_XML.xml";


File xmlFileRequest = new File(fileRequestInput);
//File file = new File(fileRequestInput);

FileInputStream fstreamRequest = new FileInputStream(xmlFileRequest);
DocumentBuilderFactory docFactory = null;
DocumentBuilder docBuilder = null;

Document document = null;
try {
docFactory = DocumentBuilderFactory.newInstance();
docBuilder = docFactory.newDocumentBuilder();
document = docBuilder.parse(fstreamRequest);
info(document.toString());


Hi Koti,
Welcome to Java Ranch!

Please use code tag to make your program more clear and readable.
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vinod Vijay wrote: . . .
Hi Koti,
Welcome to Java Ranch!
Agree
Please use code tag to make your program more clear and readable.
Since he’s new, I’ll do it. You can see how much better it looks.
 
Vinod Vijay
Ranch Hand
Posts: 165
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Since he’s new, I’ll do it. You can see how much better it looks.


Great job dude, much better now
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!