The OpenSAML V2 software has reached its End of Life and is no longer supported. This documentation is available for historical purposes only.

OSTwoUsrManCPPAnyTypes

Dealing with any Types

Some XML schemas, including SAML, make use of a special type known as anyType , from which all other types descend. These elements can take any valid XML as content, which translates to the XMLObjects representing those element allowing any XMLObject as a child and any attribute. Other elements may support element extensibility, or attribute extensibility, but not both. The XMLTooling layer includes interfaces exposing both aspects of behavior, or both at once in the form of the ElementProxy class.

Adding Content to any Types

Every XMLObject representing an XML element containing an element wildcard, or of type anyType extends ElementExtensibleXMLObject which defines the method getUnknownXMLObjects() . XMLObjects representing the content to be added to the XMLObject should be added to the container returned by that method. These child objects will then be marshalled as would any other child object. Other methods may exist to access typed containers when non-wildcard content is also known.

The AttributeExtensibleXMLObject interface also provides the ability to set arbitrary XML attributes on an XMLObject.

Reading Content of any Types

The method getUnknownXMLObjects() provides access to the unknown content of extensible XMLObjects. Reading information from this container can be problematic if you're not exactly sure what is in the returned list. If, during the unmarshalling process, the library encountered an element whose xsi:type or element name was not recognized, the library will unmarshall the element into a default implementation class.

If this default class is designed to expose and mutate the extensible data, it will support the ElementProxy interface to allow access to the information.

%COMMENT%