[jdom-interest] PI problem
Rodrigo Alvarez
ralvarez at dybox.cl
Mon Jun 20 10:46:41 PDT 2005
Hi,
I have a problem including a process instruction. I want to include the
following PI
<?xml encoding='EUC-JP'?>
When calling
map = new HashMap();
map.put("encoding",thePrefs.getProperty("xml_encoding","utf-8"));
pi = new ProcessingInstruction("xml",map);
I get a org.jdom.IllegalTargetException. Which is OK, cause I'm trying to
create a target which is not allowed. The problem is how do I include the
PI? I can´t use XMLOutputter class cause the Document is used in a
transformation, eg I'm not "outputting" the xml directly. I have not found
any other way to include the PI or set the encoding of my Document. I need
to be able to set the encoding cause my scenario is the following.
I have a Controller that convert/inserts POJO objects into a JDOM Document
and some of the objects produces characters with special encoding.
The JDOM document is then transformed with an JAXP using
TransformerFactory.transform(new JDOMSource(xmlDoc),new
StreamResult(outStream));
When some objects produce characters/text with different encoding I get an
error.
Thanks for a great product, been using it since b6. I use v 1.0 of JDOM
Regards
/Rodrigo
Rodrigo Alvarez Reygadas
Director de Innovación Tecnológica
DyBOX Consulting and Development
---------------------------------
Oracle Certified Partner
---------------------------------
Avda. Providencia 2653 Of.1701 Piso 17
Providencia, Santiago, Chile.
(562) 333 1121
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20050620/0de67044/attachment.htm
More information about the jdom-interest
mailing list