mace-opensaml-users - Re: [OpenSAML] Marshaller with 1 attribute
Subject: OpenSAML user discussion
List archive
- From: Chad La Joie <>
- To:
- Subject: Re: [OpenSAML] Marshaller with 1 attribute
- Date: Sun, 11 Jan 2009 16:53:17 +0100
- Openpgp:
- Organization: SWITCH
Depends on what you're trying to do. If you want it to an attribute you
need to use the marshallAttribute method if you want the information as
the element content than you can just use the method you are using. You
don't have to use any of the marshall methods if you don't need them.
Hubert Le Van Gong wrote:
> Greetings & Happy New Year to all !
>
> I have a question regarding the creation of an object marshaller:
> I have a simple object of the following type
>
>
> public class GetAssertion extends AbstractSignableXMLObject {
> public static String LOCAL_NAME = "GetAssertion";
> public static final String ATT_PURPOSE = "purpose";
> protected String purpose;
> private XMLObjectChildrenList<AuthnRequest> authnRequests;
>
> /.../
>
> public String getPurposeValue() {
> return this.purpose;
> }
>
> public void setPurposeValue(String val) {
> this.purpose = prepareForAssignment(this.purpose, val);
> }
> }
>
>
> The String *purpose* is an attribute in the schema definition.
> Now, when creating a marshaller for this object, is it OK to "skip" the
> MarshallAttrbutes() and do as follows:
>
>
> public class GetAssertionMarshaller extends AbstractXMLObjectMarshaller {
> @Override
> protected void marshallAttributes(XMLObject xmlObject, Element
> domElement) throws MarshallingException {
> }
>
> @Override
> protected void marshallElementContent(XMLObject xmlObject, Element
> domElement) throws MarshallingException {
> GetAssertion getAssertion = (GetAssertion) xmlObject;
> XMLHelper.appendTextContent(domElement,
> getAssertion.getPurposeValue());
> }
>
>
> If not OK, how should I write marshallAttributes() ?
>
> It seems to work fine in other instances but I wanted to check if I'm not
> "abusing" the model here.
>
>
> Cheers,
> Hubert
>
>
>
>
> --
> Hubert A. Le Van Gong
>
> Sun microsystems, Inc.
> Business Alliances - Chief Technologist's Office
>
> 17 Rue Duprey
> Grenoble, 38000
> France
>
> --------------------------------------------------
> email:
>
> tel:+33 4 7663 0935
> blog: http://blog.levangong.com/
>
> N 45 12.011'
> W 005 44.217'
>
>
--
SWITCH
Serving Swiss Universities
--------------------------
Chad La Joie, Software Engineer, Net Services
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
- Marshaller with 1 attribute, Hubert Le Van Gong, 01/11/2009
- Re: [OpenSAML] Marshaller with 1 attribute, Chad La Joie, 01/11/2009
Archive powered by MHonArc 2.6.16.