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"));

Reply via email to