• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Transforming XML using Xalan

 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am trying to write a routine that will read a source .xml and .xsl file and output a String containing the result. I am using the Sun jdk 1.4.2. The code below will successfully transform the xml, but it places the output into a file instead of a java String. Can anyone offer advice to whether I am doing this correctly and/or how to get the ouptut put into a String? I am going to be processing fairly large xml docs and I don't want to ruin performance. Thanks!

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This should do it for you:


Basically, instead of creating your StreamResult with a FileOutputStream, you should be using a ByteArrayOutputStream and then using the toString() method on the ByteArrayOutputStream.
[ August 04, 2005: Message edited by: DW Bolton ]
reply
    Bookmark Topic Watch Topic
  • New Topic