First off I see you using Streams. You should use Reader and Writer with Unicode types. Avoid going InputStreams and use Readers to load the multibyte characters. See if that helps.

Dave

Sachin wrote:
Hi All,
I have to read a japaneese file using dom4j and display in menu.What i have to do is in Middle tier my EJB read some tags from XML by using some business logic and create an Element and pass to front end now we need to display data in it on screen but till now we have not any success.as we are quite new to dom4j so we are getting problem...so if any one help it will be welcomed..
Initially what we are doing is simply tryb to read Japneese file and tried to display content but still no success.....Can any body help in this regard..
Thanks
Sachin
Here is code
String pFileName="C:\\jboss-3.0.8\\bin\\xml\\Menu_jp.xml";
try
{
File file = new File(pFileName);
InputStream lInputStream = null;
//byte[] lByte = pInputString.getBytes("UTF-8");
//lInputStream = new ByteArrayInputStream(lByte);
lInputStream = new FileInputStream(file);
System.out.println("Testing Encoding");
//org.dom4j.Document lDocument=reader.read(file);
org.dom4j.Document lDocument=reader.read(lInputStream,"EUC-JP");
System.out.println("--------------Testing Encoding--------------------------------------------------");
OutputFormat outformat = OutputFormat.createPrettyPrint();
outformat.setEncoding("EUC-JP");
XMLWriter writer = new XMLWriter(System.out, outformat);
// XMLWriter writer = new XMLWriter(System.out);
writer.write(lDocument);
org.dom4j.Element lElement=lDocument.getRootElement();
System.out.println("As XML 1"+lElement.asXML());
System.out.println("As XML 2"+lElement.getData());
System.out.println("As JP "+new String(lElement.getText().getBytes("EUC-JP"),"EUC-JP"));


--

+------------------------------------------------------------+
| David Lucas                      mailto: ddlucas @ lse.com |
| Lucas Software Engineering, Inc.   (740) 964-6248 Voice    |
| Unix,Java,C++,CORBA,XML,EJB        (614) 668-4020 Mobile   |
| Middleware,Frameworks              (888) 866-4728 Fax/Msg  |
+------------------------------------------------------------+
| GPS Location:  40.0150 deg Lat,  -82.6378 deg Long         |
| IMHC: "Jesus Christ is the way, the truth, and the life."  |
| IMHC: "I know where I am; I know where I'm going."    <><  |
+------------------------------------------------------------+

Notes: PGP Key Block=http://www.lse.com/~ddlucas/pgpblock.txt
IMHO="in my humble opinion" IMHC="in my humble conviction"
All trademarks above are those of their respective owners.




------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to