mace-opensaml-users - Re: [OpenSAML] XML altered after basic unmarshal-marshall sequence
Subject: OpenSAML user discussion
List archive
- From: Chad La Joie <>
- To:
- Subject: Re: [OpenSAML] XML altered after basic unmarshal-marshall sequence
- Date: Thu, 08 May 2008 10:53:48 -0400
- Openpgp: id=146B2514
- Organization: SWITCH
You need to understand how encoding works in the various places.
Files have a particular encoding and that's what your java.io classes operate on. The DOM has an independent encoding which indicates the encoding used for the containers of data within the DOM. You can (and I've accidentally done it before) use different encodings for each.
So, what have you is correct. It's doing exactly what you told it to. Take UTF-8 DOM and write it out to a file encoded with another encoding.
As I already told you the last time you asked, you can use the XMLHelper.writeNode method to do this.
XMLHelper.writeNode(youNode, new FileWrite("/path/to/you/file.xml"))
Paolo Selvini wrote:
I am doing a very simple test in order to better understand the cause of
another problem about XML encoding with OpenSAML.
The test is the following: take a very simple and empty SAML metadata file
like
<?xml version="1.0" encoding="ISO-8859-1"?>
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"/>
and process it with the code attached to this message. The code parses the
file with a Reader forcing ISO-8859-1 encoding, processes it through
unmarshalling and marshalling and then, without doing any modification to it,
saves it back to disk with a Writer, forcing encoding ISO-8859-1. The output
is the following:
<?xml version="1.0" encoding="UTF-8"?><md:EntityDescriptor
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"/>
You may notice the difference in the <?xml... > header, where the encoding
has been altered.
Does anybody know the cause and any possible solution / workaround?
I'm using OpenSAML-J 2.1.0.
thanks,
Paolo
________________________________
Le informazioni contenute in questa comunicazione e negli allegati sono
riservate; e' vietato a soggetti diversi dai destinatari qualsiasi uso,
copia, diffusione di quanto in essi contenuto.
Se avete ricevuto questa copia per errore, vi preghiamo di distruggerla
immediatamente ed informarci via e-mail.
Prima di stampare questa e-mail consideratene l'impatto sull'ambiente. Grazie
per la collaborazione.
This e-mail and any attachment(s) are strictly confidential. This message
must not be copied, disclosed or used by anybody other than the intended
recipient(s).
If you are not the intended recipient, please inform the sender by e-mail and
destroy this message immediately.
Please consider the environment before printing this e-mail. Thank you for
your cooperation.
--
SWITCH
Serving Swiss Universities
--------------------------
Chad La Joie, Software Engineer, Security
Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
phone +41 44 268 15 75, fax +41 44 268 15 68
,
http://www.switch.ch
- XML altered after basic unmarshal-marshall sequence, Paolo Selvini, 05/08/2008
- Re: [OpenSAML] XML altered after basic unmarshal-marshall sequence, Chad La Joie, 05/08/2008
- RE: [OpenSAML] XML altered after basic unmarshal-marshall sequence, Paolo Selvini, 05/08/2008
- Re: [OpenSAML] XML altered after basic unmarshal-marshall sequence, Chad La Joie, 05/08/2008
Archive powered by MHonArc 2.6.16.