• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAXP XSLT transform to DOMResult failure

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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'
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Get me the mayor's office! I need to tell her about this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic