Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transform result into DOM object

Status
Not open for further replies.

awolff02

Programmer
Nov 24, 2008
6
0
0
US
Hello. I have the following code with transforms a xml with xslt and sends the result to System.Out...

Code:
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.Source;
import javax.xml.transform.Result;
import javax.xml.transform.OutputKeys;

public class XMLwithXSLT 
{
public static void main(String[] args) throws Exception 

	{
	Source source = new StreamSource("Document2.xml");
        Source xsl = new StreamSource("newstylesheet1.xsl");
        Result result = new StreamResult(System.out);

        TransformerFactory factory = TransformerFactory.newInstance();

	        Transformer transformer = factory.newTransformer(xsl);
	
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
	
        transformer.transform(source, result);

    
	}

}

I would like the result of the transformation to end up in a DOM object so I can post it to a WebService. Any help is appreciated.

Alex-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top