Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » XSLT(Transforming XML to another format)
XSLT [message #758570] Wed, 23 November 2011 17:46 Go to next message
mehmetberat01 is currently offline mehmetberat01Friend
Messages: 1
Registered: November 2011
Junior Member
Hi everyone,

I'm trying to write a program with java, which transforms the XML files with XSLT codes.

I've used Swing and added 2 buttons. Each button opens a filechooser. And with these filechoosers, i can import my xml and xsl file.

        File xmlfile=null;
	File xsltfile=null;
        .....
        .....
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            	xmlfile = fc.getSelectedFile();      
            } 

        .....
        .....
         if (returnVal == JFileChooser.APPROVE_OPTION) {
                xsltfile = fc.getSelectedFile();
             }


And then i'm saving the transformed XML file to this directory "/home/berat/transformed.xml"

try {
Transformer trans=transFact.newTransformer(xsltSource);	

trans.transform(xmlSource, new StreamResult(new File("/home/beratTransformed.xml")));
} 
catch (TransformerConfigurationException e1) {
e1.printStackTrace();
} 
catch (TransformerException e2) {
e2.printStackTrace();
}


As you can see in my directory, i'm using linux. But i'm doing this project with a friend of mine and his operating system is windows.

So that's why i wanted to create a new file in my eclipse project. And call it Transformed.xml, to save the transformed file directly in the same package of my code.

But i couldn't make my program recognize the Transformed.xml. How can i solve it?

Thanks.

(You can see my whole code in attachment)
  • Attachment: transform
    (Size: 4.32KB, Downloaded 113 times)

[Updated on: Wed, 23 November 2011 17:49]

Report message to a moderator

Re: XSLT [message #759797 is a reply to message #758570] Wed, 30 November 2011 06:23 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

What do you mean by "recognize the Transformed.xml"? And what have you tried so far? What you've written is just hard-coded one way.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Binding same Eclipse key combination in multiple Team Provider contexts
Next Topic:Jars in EAR not Showing
Goto Forum:
  


Current Time: Sat Apr 27 04:20:55 GMT 2024

Powered by FUDForum. Page generated in 0.08219 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top