Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

transform the xml with ' and "

843834May 6 2008 — edited May 7 2008
HI,

i am converting from one xml to anther xml using XSLT, in my output xml file
' 
values are replacing with ' symbols. i want
' 
values in my output xml file.

my input xml file is
<?xml version="1.0" encoding="UTF-8"?>
<ARTICLE>
<TITLE>A Sample Article123456&apos;123456&apos;</TITLE>
</ARTICLE>

my xslt file is

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml"/>
<xsl:template match="/">
<Message>
<xsl:apply-templates/>
</Message>

</xsl:template>
<xsl:template match="/ARTICLE/TITLE">
<Sample><xsl:value-of select="/ARTICLE/TITLE" />
</Sample>
</xsl:template>
</xsl:stylesheet>

my java source code

public class MessageGeneration
{
public static void main(String []a)throws Exception
{
Reader xmlSourceReader;
Writer xmlResultWriter;
xmlSourceReader = new InputStreamReader(new FileInputStream(
"src/xml/message.xml"), "UTF-8");
xmlResultWriter = new OutputStreamWriter(new FileOutputStream(
"src/xml/outMessage.xml"), "UTF-8");
TransformerFactory tranFactory = TransformerFactory.newInstance();
Transformer transformer = tranFactory.newTransformer(source);
StreamSource xmlSource1 = new StreamSource(xmlSourceReader);
StreamResult xmlResult1 = new StreamResult(xmlResultWriter);
transformer.transform(xmlSource1, xmlResult1);
}
}

how can i get
&apos; 
symbols in my out file.

Thanks
Dattu
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 4 2008
Added on May 6 2008
3 comments
494 views