Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] I am new to XOM, can I create and read XML documents that contains Japnese characters? Please reply soon, URGENT!! Thanks!

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Ed Davies <edavies AT nildram.co.uk>
  • To: Angela Amoateng <angela.amoateng AT kcl.ac.uk>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] I am new to XOM, can I create and read XML documents that contains Japnese characters? Please reply soon, URGENT!! Thanks!
  • Date: Mon, 21 May 2007 11:45:27 +0100

Angela Amoateng wrote:
Will it also be able to read Japanese characters (unicode) too?

Ed Davies wrote:
I've never tried that specifically but I really think
it's supposed to and I'd be very surprised if it didn't.
Give it a try. That's one of the great advantages of
free software - it only costs you a short learning
period to find out if it's right for what you want to
do.

Sorry, curiosity got the better of me...

File h.java:

import nu.xom.*;
import java.io.*;

public class h {

public static void main(String[] args) throws ParsingException,
IOException {

Builder builder = new Builder(false);
Document doc = builder.build(System.in, "http://example.com/";);
Element root = doc.getRootElement();
System.out.println("We got the string '" + root.getValue() + "'");
}
}

File t:

<hi>あき</hi>

Linux commands:

export CLASSPATH=.:/usr/local/lib/xom-1.1/xom-1.1.jar
javac h.java && java h < t

Prints:

We got the string 'あき'

Both the files, the output and this message are in
UTF-8, of course.

I haven't got the faintest idea if those two symbols
in that order have any meaning at all so if they do
and it's obscene don't blame me :-).

Ed.





Archive powered by MHonArc 2.6.24.

Top of Page