?
Solved

XML

Posted on 2004-04-21
7
Medium Priority
?
252 Views
Last Modified: 2010-04-01
Hi Experts,

I have XML file and XSLT(formats CSV file) that are ready for use.
How to make in JSP to write this file to temp directory and open using Internet Explorer ?

Thank you.
0
Comment
Question by:fpoyavo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10883278
How to make write what???

do you want to apply the XSL to XML and get the out put a file or browser????
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10883583
Yep. Write transformed CSV file to temp dir and then open it from there via Internet Explorer (this is all has to be done within JSP)

i KNOW you are the best. Thank you.
0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 2000 total points
ID: 10883994
try
      {
      tFactory = TransformerFactory.newInstance();
      transformer = tFactory.newTransformer(new StreamSource(new File(your xsl file));
      StringWriter sw = new StringWriter();
      transformer.transform(new StreamSource(new File(your xml file)),
                          new StreamResult(sw));

            System.out.println("transformed");
            out.print(sw.toString()); // this will send the data to the Browser directly..
      }catch(Exception e)
      {
            e.printStackTrace();
            out.print("Got errors transforming");
      }

Now in here I am sending the out put of transformation directly to the browser...
you can direct to a file just by changing
line
transformer.transform(new StreamSource(new File(your xml file)),
                          new StreamResult(new File(your destination file));
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:fpoyavo
ID: 10884514
Thanks man I will try it.
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10884593
One question. If I run this JSP on Linux and need to open it as Excel file how exactly it ca ne accomplished ?
I assume this code will just print it in browser nto open it as Excel file. Right ? May be I am missing something ?
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10884626
you will have to set your content type to application/excel by doing

response.setContentType("application/excel");
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10884796
kULDEEP,

Would you please tell me where and how to use it ?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introducing Priority Question, our latest feature.
The Summer 2017 Scholarship Winners have been announced!
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

801 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