Skip to Content.
Sympa Menu

mace-opensaml-users - Marshaller with 1 attribute

Subject: OpenSAML user discussion

List archive

Marshaller with 1 attribute


Chronological Thread 
  • From: Hubert Le Van Gong <>
  • To:
  • Subject: Marshaller with 1 attribute
  • Date: Sun, 11 Jan 2009 11:49:08 +0100

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

N 45  12.011'
W 005  44.217'




Archive powered by MHonArc 2.6.16.

Top of Page