If you won't be searching against the XML in the database another option may be
to save the XML as raw bytes and convert in to a string on the java side.  This
option provides the added benefit of allowing you to compress the XML which
reduces the amount of bytes that has to be shuffled between the database and
your app, plus it makes for better disk space usage --which is really an over
statement because the cost of disk space is so cheap--.


Dane Foster
----- Original Message ----- 
From: "David D. Lucas" <[EMAIL PROTECTED]>
To: "Martin Gross" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, June 06, 2003 13:31
Subject: Re: [dom4j-user] how to encode an entity with dom4j


I was interested in what marks were available for TM myself and did some
investigation.  Based on the information at the link
http://www.pemberley.com/janeinfo/latin1.html

iso-8859-1 does not support "TM" trade mark symbol.  It appears that
maybe the tool you are using is converting on the console display the
binary equivalent.  When you parse in the encoding, it will convert it
to what your standard encoding is, thus a potential different map (i.e.
a square or question mark looking character).

I tried doing the (R) and (C) with no problems.  They are valid
iso-8859-1 characters.

You may want to try putting int the outgoing XML the unicode for CP1252
(Windows character set) "&#8482;" to see if the display comes up the way
you want.  But your mileage may vary based on the native display text
encoding.

Not sure what to say other than verify the Unicode values and try adding
it to the setText like.

String registered = "\u00AE";
element.setText("My Mark"+registered);

This will be converted to the correct "&#xxx;" number so it can travel
over XML.

Best Wishes!

Dave


Martin Gross wrote:
> The application is Jakarta Struts based. When the form is submitted
> the values are stored in Bean e.g. theItem and stored in the DOM tree:
>
>     Element elem = getElementByIdAttribute (theItem.getId());
>     log.trace(theItem.getHeadline());
>     elem.element("headline").setText(theItem.getHeadline());
>
> When everything is stored I write into a file with the following code:
>
>     OutputFormat format = new OutputFormat( "", false, "iso-8859-1");
>     FileWriter out = new FileWriter(file);
>     XMLWriter writer = new XMLWriter( out, format );
>     writer.write( doc );
>     out.close();
>
> Thanks,
> Martin
>
>
>
>>Martin,
>
>
>>When you say submit, what do you do?  Can you provide snippets of the
>>code?  How do you "write" out the DOM tree?  Are you using an
>>org.dom4j.io.OutputFormat instance combined with the XmlWriter?
>
>
>>More info please. ;-)
>
>
>>Thanks,
>>Dave
>
>
>>Martin Gross wrote:
>>
>>>hi,
>>>
>>> this is probably a very basic question, but I still haven't found a
>>> solution for it by browsing through the list archive.
>>>
>>> I have written a web application that generates some xml files with
>>> iso-8859-1 encoding. in an dtd file I defined a entity
>>> e.g. <!ENTITY trademark "&#x99;">.
>>>
>>> My XML file contains <headline>Test &trademark;</headline>
>>>
>>> When I parse the document for reading everything works fine. The
>>> trademark symbol is properly displayed in the form field of my
>>> browser form.
>>>
>>> But when I submit my form, the trademark symbol is replaced by an
>>> question mark: <headline>Test ?</headline>
>>>
>>> If I write 'Test &trademark;' into the form field the following is
>>> written into the xml file: <headline>Test &amp;trademark;</headline>
>>>
>>> How do I get the entity into the xml file with dom4j?
>>>
>>>best regards,
>>>martin
>>>
>>>
>>>
>>>-------------------------------------------------------
>>>This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
>>>thread debugger on the planet. Designed with thread debugging features
>>>you've never dreamed of, try TotalView 6 free at www.etnus.com.
>>>_______________________________________________
>>>dom4j-user mailing list
>>>[EMAIL PROTECTED]
>>>https://lists.sourceforge.net/lists/listinfo/dom4j-user
>>>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
> thread debugger on the planet. Designed with thread debugging features
> you've never dreamed of, try TotalView 6 free at www.etnus.com.
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>


-- 

+------------------------------------------------------------+
| David Lucas                        mailto:[EMAIL PROTECTED]  |
| 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.




-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to