Once you've parsed a document, you can output it using another character
encoding mechanism via the XMLWriter.

OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding( "UTF-8" );
XMLWriter writer = new XMLWriter( new FileOutputStream("foo.txt"), format);
writer.write(doc);
writer.close();

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 10, 2002 11:14 AM
Subject: [dom4j-user] Reading document with norwegian characters


Hello,

I have a problem with lot's of XML-files I want to parse with the
SAXReader object. They all start with this heading:

<?xml version = "1.0" standalone = "no"?>
<!DOCTYPE configData SYSTEM "configFile.dtd">

Even if the attribute

'encoding="UTF-8"'

is not there in the preamble, it seems that my parser implements
this as default, since norwegian charcters are not recognized as
valid.

Is there anyway I can override this default? Guess I need to
enforce the setting 'encoding="ISO-8859-1"', but it
would be reeealy neat if I could do this in the code, not having
to edit all the files manually...

Best regards,
Helge Fredriksen


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to