[geotk] Problem with 'copyright' special character when XML marshalling
Emmanuel Blondel
emmanuel.blondel1 at gmail.com
Tue Jan 21 08:39:34 PST 2014
Thanks Martin,
I've finally solved the issue, actually it was due to a wrong option
set-up in the Java environment where the Java app was run, dealing with
the file.encoding. The application, which handles successively the
metadata creation & publication was giving an Exception at metadata
insertion time because of this encoding. So nothing wrong with the JAXB
marshalling actually.
Anyway, i've taken the opportunity to learn a bit a more about
CharacterEscapeHandler which indeed could be useful to know.
For the migration to Apache SIS, indeed i've planned to start it soon.
I will post message on Apache SIS mailing list if i face issues.
Many thanks for your prompt support
Emmanuel
Le 21/01/2014 11:21, Martin Desruisseaux a écrit :
> Hello Emmanuel
>
> Thanks for the links.
>
> Le 20/01/14 16:41, Emmanuel Blondel a écrit :
>> (...snip...) Why the copyright is not converted to ©? Same
>> question for diacritics (see spanish words).
> Such conversions should not be necessary if the XML file is encoded in
> UTF-8... However if someone wishes to force character conversions, I
> found the following blog which gives a tip about how to do that with JAXB:
>
> http://lauraliparulo.altervista.org/jaxb-part-5-xml-character-handler/
>
> If you choose this approach, you could define your own
> CharacterEscapeHandler and set the property to the Marshaller created
> by Geotk. Note however that the package name
> (com.sun.xml.bind.marshaller) suggests that this is not an officially
> supported API. And if you use the JAXB implementation bundled in the
> JDK rather than the "endorsed" one, then the package name may be
> com.sun.xml.internal.bind.marshaller.
>
>> (...snip...) I point you to the code i use:
>> - Metadata (where i use the copyright symbol in a citation template):
>> https://github.com/openfigis/gis-tools/blob/master/gis-metadata/gis-metadata/main/src/main/java/org/fao/fi/gis/metadata/GeographicEntityMetadata.java
>> (row: 332 - 345)
>> - publisher (where i marshall to XML and publish the xml to
>> Geonetwork):
>> https://github.com/openfigis/gis-tools/blob/master/gis-metadata/gis-metadata/publisher/src/main/java/org/fao/fi/gis/metadata/publisher/MetadataPublisher.java#L67
>
> I had a look at the code and it seems all right, so I think that the
> issue is about configuring JAXB for example with the above-cited
> CharacterEscapeHandler.
>
> Can I suggest something? :-) As you may know, we are migrating Geotk
> to Apache SIS (http://sis.apache.org). If the only Geotk API that you
> are using is metadata, this part is already available in Apache SIS
> 0.3. Future evolutions and bugs fixes will happen on Apache side.
> Actually most metadata object are already deleted from Geotk and
> replaced by reference to the Apache classes. The metadata API is close
> to identical. If you wish to migrate, the only thing that you need to
> do is to replace your dependency in the pom.xml (if you are using
> Maven) by that one (use "sis-metadata" instead than "sis-referencing"):
>
> http://sis.apache.org/downloads.html#maven
>
> and replace "import org.geotoolkit..." by "import org.apache.sis..."
> (most class names are identical). Some exceptions are
> SimpleInternationalString which is located in org.apache.sis.util.iso
> (an "iso" sub-package has been added), and Anchor which is handled in
> a slightly different way - I will help you with that one if you are
> interested in the migration, ideally on the Apache SIS mailing list if
> you agree.
>
> Our plan is to keep Geotk as a "laboratory" for Apache SIS. Geotk
> would be built on top of SIS, and Geotk classes are expected to
> migrate to SIS when they are considered mature enough. When a Geotk
> class migrate to SIS, the Geotk one is deprecated before deletion.
>
> Regards,
>
> Martin
>
>
>
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit
--
*Emmanuel Blondel*
GIS Consultant
Engineer in Agronomy & Environment
Geographic Information Systems
in Agronomy - Environment - Fisheries
Email: emmanuel.blondel1 at gmail.com - Emmanuel.Blondel at fao.org
View my LinkedIn profileView my LinkedIn profile
<http://fr.linkedin.com/in/emmanuelblondel1>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20140121/97988e7a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: btn_in_20x15.png
Type: image/png
Size: 288 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20140121/97988e7a/attachment.png>
More information about the Geotoolkit
mailing list