This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XSLT Transformation in jav Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT Transformation in jav" Watch "XSLT Transformation in jav" New topic
Author

XSLT Transformation in jav

vinay kumar
Ranch Hand

Joined: Sep 23, 2006
Posts: 31
Hi,

I am transforming an xml using xsl in java. Getting 'ERROR: Content is not allowed in prolog.' Here is the code. xml and xsl are two string variables which read from corresponding xml and xsl files.


Please help.

thanks,
vinay
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Content not allowed in prolog usually means the document does not start with <?xml etc.

Now for the real question - why in the world are you doing this convoluted business of reading with a Reader, building a String, and turning the String into a byte stream and then into a StreamSource.

You can turn a BufferedReader directly into an InputSource.

Bill
[ October 15, 2006: Message edited by: William Brogden ]
vinay kumar
Ranch Hand

Joined: Sep 23, 2006
Posts: 31
Ooh.. I had some text before xml declaration.

Thanks william.. It is working now..

vinay.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XSLT Transformation in jav
 
Similar Threads
ServletOutputStream.write not working in IE 7
Converting an application using xstl from struts to struts 2
xml transform code just not behaving
transformation of xsl within several threads - performance problems
XML Parsing