mace-opensaml-users - Re: [OpenSAML] XMLTooling: How to set whiteSpace to preserve?
Subject: OpenSAML user discussion
List archive
- From: Brent Putman <>
- To:
- Subject: Re: [OpenSAML] XMLTooling: How to set whiteSpace to preserve?
- Date: Mon, 21 Mar 2011 12:09:42 -0400
On 3/21/11 11:33 AM, Hauke Mehrtens wrote:
> The resulting XML looks like this:
>
> <saml2:AttributeValue
> xmlns=\"http://www.w3.org/2001/XMLSchema-instance\"
> xmlns:idp=\"http://mydomain.de/namespace123/\"
> xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
> xsi:type=\"idp:GeneralDateType\"><idp:DateString>200103</idp:DateString></saml2:AttributeValue>
>
> We want the xml to look like this:
> <idp:DateString>200103 </idp:DateString>
>
> How do we generate such an xml with OpenSAML and XMLTooling?
We don't have any built-in options for preserving space like that. That
only way that you can achieve is custom XMLObject provider classes. The
relevant method that you would need to customized/override is in the
AbstractXMLObject:
protected String prepareForAssignment(String oldValue, String newValue)
{ ...}
That is where the whitespace trimming is happening.
Since you have a non-trivial complex type, I'd recommend that, instead
of using the XSAny default provider, you create an XMLObject interface
and impl, marshaller, and unmarshaller for your complex type, and then
register that provider set in the configuration for the type
idp:GeneralDateType. That would be the complete and "proper" way to do
this.
A quick and dirty way, using the XSAny approach, would be to just
subclass XSAnyImpl, override prepareForAssignment, and then create a
builder that uses that new subclass rather than the default XSAnyImpl.
Hope that helps,
Brent
- [OpenSAML] XMLTooling: How to set whiteSpace to preserve?, Hauke Mehrtens, 03/21/2011
- Re: [OpenSAML] XMLTooling: How to set whiteSpace to preserve?, Brent Putman, 03/21/2011
- Re: [OpenSAML] XMLTooling: How to set whiteSpace to preserve?, Brent Putman, 03/21/2011
- Re: [OpenSAML] XMLTooling: How to set whiteSpace to preserve?, Brent Putman, 03/21/2011
Archive powered by MHonArc 2.6.16.