Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] OpenSAML 2.0 custom data type help

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] OpenSAML 2.0 custom data type help


Chronological Thread 
  • From: Neill Miller <>
  • To:
  • Subject: Re: [OpenSAML] OpenSAML 2.0 custom data type help
  • Date: Fri, 6 Feb 2009 12:47:24 -0600 (CST)

Hello,

Yes, Scott is correct here. I do the following in Java:

MarshallerFactory marshallerFactory = Configuration.getMarshallerFactory();
Marshaller marshaller = marshallerFactory.getMarshaller(assertion);
Element assertionElem = marshaller.marshall(assertion);

TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();

transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");

StringWriter sWriter = new StringWriter();
StreamResult sResult = new StreamResult(sWriter);
DOMSource domSource = new DOMSource((Node)assertionElem);
transformer.transform(domSource, sResult);
String xml = sWriter.toString();
System.out.println(xml);

Hope that helps,
-Neill.

----- Original Message -----
From: "Scott Cantor"
<>
To:

Sent: Friday, February 6, 2009 12:40:34 PM GMT -06:00 US/Canada Central
Subject: RE: [OpenSAML] OpenSAML 2.0 custom data type help

Nguyen, Thai Q. wrote on 2009-02-06:
> Sorry I can't help but I have a question: How do you dump the XML?
> I can do it in OpenSAML 1.1 but could not find the way to do it in 2.0.

You marshall the object to a DOM and then serialize the DOM however you want
to, for which there are helper methods also available.

-- Scott





Archive powered by MHonArc 2.6.16.

Top of Page