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: Mon, 9 Feb 2009 10:50:15 -0600 (CST)

Hello Brent,

The type emission was not the original question. I'm more concerned with
generating a valid AttributeValue format for my custom type. Compare the two
XML snippets (the first one being invalid, but generatable in code):

--------------------
<saml:Attribute Name="MyAttribute" NameFormat="myType">
<myns:myType xmlns:myns="http://www.myns.org";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; param1="foo"
param2="bar" xsi:type="myns:myType"/>
</saml:Attribute>

What I (think I) want though is something like this:

<saml:Attribute Name="MyAttribute" NameFormat="myType">
<saml:AttributeValue xmlns:myns="http://www.myns.org";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:type="myns:myType">
<myns:myType param1="foo" param2="bar"/>
</saml:AttributeValue>
</saml:Attribute>
--------------------

I can get (very) close to the latter output by building that XML string in
the marshallElementContent method (and commenting out my marshallAttributes
method) of my marshaller, and adding it to the domElement there, but the
brackets get escaped in that case:

<saml:Attribute Name="MyAttribute" NameFormat="myType">
<saml:AttributeValue xmlns:myns="http://www.myns.org";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:type="myns:myType">
&lt;myns:myType param1="foo" param2="bar"/&gt;
</saml:AttributeValue>
</saml:Attribute>

That's likely because of the way the XMLHelper.appendTextContent is working.
Is there another method I can use that won't cause the escaping, or is there
a better XML output format I should be working toward to get this going?

All of that aside, I think I can leave out the custom type as you guys
suggested, but it doesn't help with the general formatting of the data type.
How do I properly build the type so it fits within the AttributeValue tag?
Are there any examples that aren't the XS* types included in the library?

thanks,
-Neill.


----- Original Message -----
From: "Brent Putman"
<>
To:

Sent: Monday, February 9, 2009 10:37:20 AM GMT -06:00 US/Canada Central
Subject: Re: [OpenSAML] OpenSAML 2.0 custom data type help



Neill Miller wrote:
> Hello Brent,
>
> Thanks, the prettyPrintXML method looks great.

Just be aware that if you're doing signing, you can't use pretty print.
You have to serialize using a mechanism that doesn't modify the signed
DOM, which pretty printing does. That method is primarily only for use
in making log files or debug output more easily human-readable.

> Any ideas on my original question about the custom data type building
> into the AttributeValue?
>

I thought that Scott and I had already answered that question. For the
reasons Scott stated, you probably don't want the xsi:type to be
emitted. You can achieve that by using one of the builder build(...)
methods that doesn't take the type QName argument.

--Brent






Archive powered by MHonArc 2.6.16.

Top of Page