Hi, I do have problem while parsing a dollar symbol through my xml,basically when a dollar symbol comes in the xml which i convert to other xml using xslt ,the dollar symbol gets converted to a two character symbol (some symbol followed by dollar symbol like (A�))
I use jdk 1.4 and for parsing i use SAX API and JAXP ,The encoding of my input xml is UTF-8 and one used in xsl is the same .If I use the same input xml and same xsl with tool like altova the dollar symbol appears properly in the output
Can Anyone suggest a way out for this problem Thanks in Advance
Well, perhaps you aren't letting your parser use the document's encoding, but using a different encoding yourself. Or perhaps something else is wrong with the way you call the parser. Would you like to show us your code? Without it, we're just speculating.
Same with this "output" that you're displaying to. Is it the console? A Swing GUI? A web application? All of those things have their own challenges. Providing details always helps.
Joined: Oct 08, 2008
Follwing is the code for xml trnasformation ,the API used is jaxp and java version is 1.4
The input xml something looks like this <name>�</name>
The xsl used for transformation looks like this: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="name"> <name> <xsl:value-of select="."/> </name>
The code for processing is We call the below method for transforming the xml into other xml by supplying the Input xml,the name of xsl to use,and hashtable containing the value of parametr used in xsl
TransformerFactory tFactory = TransformerFactory.newInstance(); String xsl = //The xsl file of which name is mentioned in the method signature loads though some code from here through singelton class(which loads xsl into memory when server is started) and the particular xsl
bais = new ByteArrayInputStream(xsl.getBytes()); inStreamReader = new InputStreamReader(bais); reader = new BufferedReader(inStreamReader);
StreamSource source = new StreamSource(reader); Transformer transformer = tFactory.newTransformer(source);