wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes JAXP XSLT transform to DOMResult failure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXP XSLT transform to DOMResult failure" Watch "JAXP XSLT transform to DOMResult failure" New topic
Author

JAXP XSLT transform to DOMResult failure

M Galevsky
Greenhorn

Joined: Mar 05, 2008
Posts: 10
Hi all,

I am running the following code well:

[...]
StreamResult fileResult= new StreamResult(outputFile);
Transformer transformer = xmlWritter.newTransformer(new javax.xml.transform.stream.StreamSource("./my_sheet.xsl"));
transformer.transform(new DOMSource(dom), fileResult);
[...]

it generates the outputFile as expected.

Now, I would like to get a DOMResult instead:

[...]
DOMResult domResult= new DOMResult();
Transformer transformer = xmlWritter.newTransformer(new javax.xml.transform.stream.StreamSource("./my_sheet.xsl"));
transformer.transform(new DOMSource(dom), domResult);
[...]

But execution fails on :

ERREUR : 'HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it
is not permitted. '

Anyone can help ?

Thks very much,

Gal'
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

My guess is that your XSL produces something that isn't an XML document. This doesn't matter when you are writing to a file, but you can't produce a DOM unless your output is a well-formed XML document.

Most likely your output doesn't have a single root element, but I suppose there are other possibilities.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAXP XSLT transform to DOMResult failure
 
Similar Threads
Help needed on "Expand empty XML node"
redirect XML/DOM output to file??
Publishing PDF From XML,XSL using FOP
org.w3c.dom.* saves my XML with attributes in alphabetical order
xml output formatting