Java Code Examples for org.opensaml.xml.XMLObject

The following examples show how to use org.opensaml.xml.XMLObject. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: micro-integrator   Author: wso2   File: WSXACMLEntitlementServiceClient.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Serialize XML objects
 *
 * @param xmlObject : XACML or SAML objects to be serialized
 * @return serialized XACML or SAML objects
 */
private String marshall(XMLObject xmlObject) throws EntitlementProxyException {

    try {
        doBootstrap();
        System.setProperty(DOCUMENT_BUILDER_FACTORY, DOCUMENT_BUILDER_FACTORY_IMPL);

        MarshallerFactory marshallerFactory = org.opensaml.xml.Configuration.getMarshallerFactory();
        Marshaller marshaller = marshallerFactory.getMarshaller(xmlObject);
        Element element = marshaller.marshall(xmlObject);

        ByteArrayOutputStream byteArrayOutputStrm = new ByteArrayOutputStream();
        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
        DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
        LSSerializer writer = impl.createLSSerializer();
        LSOutput output = impl.createLSOutput();
        output.setByteStream(byteArrayOutputStrm);
        writer.write(element, output);
        return new String(byteArrayOutputStrm.toByteArray(), Charset.forName("UTF-8"));
    } catch (Exception e) {
        log.error("Error Serializing the SAML Response");
        throw new EntitlementProxyException("Error Serializing the SAML Response", e);
    }
}
 
Example #2
Source Project: lams   Author: lamsfoundation   File: RSAKeyValueImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
    ArrayList<XMLObject> children = new ArrayList<XMLObject>();
    
    if (modulus != null) {
        children.add(modulus);
    }
    if (exponent != null) {
        children.add(exponent);
    }
    
    if (children.size() == 0) {
        return null;
    }
    
    return Collections.unmodifiableList(children);
}
 
Example #3
Source Project: lams   Author: lamsfoundation   File: AbstractMetadataProvider.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
public XMLObject getMetadata() throws MetadataProviderException {
    if (!isInitialized()) {
        throw new MetadataProviderException("Metadata provider has not been initialized");
    }

    XMLObject metadata = doGetMetadata();

    if (metadata == null) {
        log.debug("Metadata provider does not currently contain any metadata");
    }

    if (!isValid(metadata)) {
        log.debug("Metadata document exists, but it is no longer valid");
        return null;
    }

    return metadata;
}
 
Example #4
Source Project: lams   Author: lamsfoundation   File: SOAPHelper.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a header block from the SOAP envelope contained within the specified message context's
 * {@link MessageContext#getOutboundMessage()}.
 * 
 * @param msgContext the message context being processed
 * @param headerName the name of the header block to return 
 * @param targetNodes the explicitly specified SOAP node actors (1.1) or roles (1.2) for which the header is desired
 * @param isFinalDestination true specifies that headers targeted for message final destination should be returned,
 *          false specifies they should not be returned
 * @return the list of matching header blocks
 */
public static List<XMLObject> getOutboundHeaderBlock(MessageContext msgContext, QName headerName,
        Set<String> targetNodes, boolean isFinalDestination) {
    XMLObject outboundEnvelope = msgContext.getOutboundMessage();
    if (outboundEnvelope == null) {
        throw new IllegalArgumentException("Message context does not contain an outbound SOAP envelope");
    }
    
    // SOAP 1.1 Envelope
    if (outboundEnvelope instanceof Envelope) {
        return getSOAP11HeaderBlock((Envelope) outboundEnvelope, headerName, targetNodes, isFinalDestination);
    }
    
    //TODO SOAP 1.2 support when object providers are implemented
    return Collections.emptyList();
}
 
Example #5
Source Project: lams   Author: lamsfoundation   File: RequestAbstractTypeUnmarshaller.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    RequestAbstractType req = (RequestAbstractType) samlObject;

    if (attribute.getLocalName().equals(RequestAbstractType.VERSION_ATTRIB_NAME)) {
        req.setVersion(SAMLVersion.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(RequestAbstractType.ID_ATTRIB_NAME)) {
        req.setID(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else if (attribute.getLocalName().equals(RequestAbstractType.ISSUE_INSTANT_ATTRIB_NAME)
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        req.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(RequestAbstractType.DESTINATION_ATTRIB_NAME)) {
        req.setDestination(attribute.getValue());
    } else if (attribute.getLocalName().equals(RequestAbstractType.CONSENT_ATTRIB_NAME)) {
        req.setConsent(attribute.getValue());
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
Example #6
Source Project: lams   Author: lamsfoundation   File: AssertionUnmarshaller.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {

    Assertion assertion = (Assertion) parentSAMLObject;

    if (childSAMLObject instanceof Signature) {
        assertion.setSignature((Signature) childSAMLObject);
    } else if (childSAMLObject instanceof Conditions) {
        assertion.setConditions((Conditions) childSAMLObject);
    } else if (childSAMLObject instanceof Advice) {
        assertion.setAdvice((Advice) childSAMLObject);
    } else if (childSAMLObject instanceof Statement) {
        assertion.getStatements().add((Statement) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
Example #7
Source Project: lams   Author: lamsfoundation   File: RoleDescriptorImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
    ArrayList<XMLObject> children = new ArrayList<XMLObject>();

    if (getSignature() != null) {
        children.add(getSignature());
    }

    if (extensions != null) {
        children.add(getExtensions());
    }
    children.addAll(getKeyDescriptors());
    if (organization != null) {
        children.add(getOrganization());
    }
    children.addAll(getContactPersons());

    return Collections.unmodifiableList(children);
}
 
Example #8
Source Project: lams   Author: lamsfoundation   File: EncryptionMethodImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
    ArrayList<XMLObject> children = new ArrayList<XMLObject>();
    
    if (keySize != null) {
        children.add(keySize);
    }
    if (oaepParams != null) {
        children.add(oaepParams);
    }
    
    children.addAll(unknownChildren);
    
    if (children.size() == 0) {
        return null;
    }
    
    return Collections.unmodifiableList(children);
}
 
Example #9
Source Project: lams   Author: lamsfoundation   File: XMLObjectHelper.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Marshall an XMLObject.  If the XMLObject already has a cached DOM via {@link XMLObject#getDOM()},
 * that Element will be returned.  Otherwise the object will be fully marshalled and that Element returned.
 * 
 * @param xmlObject the XMLObject to marshall
 * @return the marshalled Element
 * @throws MarshallingException if there is a problem marshalling the XMLObject
 */
public static Element marshall(XMLObject xmlObject) throws MarshallingException {
    Logger log = getLogger();
    log.debug("Marshalling XMLObject");
    
    if (xmlObject.getDOM() != null) {
        log.debug("XMLObject already had cached DOM, returning that element");
        return xmlObject.getDOM();
    }

    Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(xmlObject);
    if (marshaller == null) {
        log.error("Unable to marshall XMLOBject, no marshaller registered for object: "
                + xmlObject.getElementQName());
    }
    
    Element messageElem = marshaller.marshall(xmlObject);
    
    if (log.isTraceEnabled()) {
        log.trace("Marshalled XMLObject into DOM:");
        log.trace(XMLHelper.nodeToString(messageElem));
    }
    
    return messageElem;
}
 
Example #10
Source Project: lams   Author: lamsfoundation   File: SOAPHelper.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Gets the <code>soap11:actor</code> attribute from a given SOAP object.
 * 
 * @param soapObject the SOAP object to add the attribute to
 * 
 * @return the value of the actor attribute, or null if not present
 */
public static String getSOAP11ActorAttribute(XMLObject soapObject) {
    String value = null;
    if (soapObject instanceof ActorBearing) {
        value = DatatypeHelper.safeTrimOrNullString(((ActorBearing) soapObject).getSOAP11Actor());
        if (value != null) {
            return value;
        }
    }
    if (soapObject instanceof AttributeExtensibleXMLObject) {
        value = DatatypeHelper.safeTrimOrNullString(((AttributeExtensibleXMLObject) soapObject)
                .getUnknownAttributes().get(ActorBearing.SOAP11_ACTOR_ATTR_NAME));
        return value;
    }
    return null;
}
 
Example #11
Source Project: lams   Author: lamsfoundation   File: SPSSODescriptorMarshaller.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
    SPSSODescriptor descriptor = (SPSSODescriptor) samlObject;

    if (descriptor.isAuthnRequestsSignedXSBoolean() != null) {
        domElement.setAttributeNS(null, SPSSODescriptor.AUTH_REQUESTS_SIGNED_ATTRIB_NAME, descriptor
                .isAuthnRequestsSignedXSBoolean().toString());
    }

    if (descriptor.getWantAssertionsSignedXSBoolean() != null) {
        domElement.setAttributeNS(null, SPSSODescriptor.WANT_ASSERTIONS_SIGNED_ATTRIB_NAME, descriptor
                .getWantAssertionsSignedXSBoolean().toString());
    }

    super.marshallAttributes(samlObject, domElement);
}
 
Example #12
Source Project: lams   Author: lamsfoundation   File: AdviceUnmarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {

    Advice advice = (Advice) parentSAMLObject;

    if (childSAMLObject instanceof Assertion) {
        advice.getAssertions().add((Assertion) childSAMLObject);
    } else if (childSAMLObject instanceof AssertionIDReference) {
        advice.getAssertionIDReferences().add((AssertionIDReference) childSAMLObject);
    } else {
        advice.getUnknownXMLObjects().add(childSAMLObject);
    }
}
 
Example #13
Source Project: lams   Author: lamsfoundation   File: NewIDMarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
    NewID newID = (NewID) samlObject;

    if (newID.getNewID() != null) {
        XMLHelper.appendTextContent(domElement, newID.getNewID());
    }
}
 
Example #14
Source Project: steady   Author: eclipse   File: SAMLUtils.java    License: Apache License 2.0 5 votes vote down vote up
private static List<String> parseRolesInAssertion(org.opensaml.saml2.core.Assertion assertion,
            String roleAttributeName) {
        List<org.opensaml.saml2.core.AttributeStatement> attributeStatements = 
            assertion.getAttributeStatements();
        if (attributeStatements == null || attributeStatements.isEmpty()) {
            return null;
        }
        List<String> roles = new ArrayList<String>();
        
        for (org.opensaml.saml2.core.AttributeStatement statement : attributeStatements) {
            
            List<org.opensaml.saml2.core.Attribute> attributes = statement.getAttributes();
            for (org.opensaml.saml2.core.Attribute attribute : attributes) {
                
                if (attribute.getName().equals(roleAttributeName)) {
                    for (XMLObject attributeValue : attribute.getAttributeValues()) {
                        Element attributeValueElement = attributeValue.getDOM();
                        String value = attributeValueElement.getTextContent();
                        roles.add(value);                    
                    }
                    if (attribute.getAttributeValues().size() > 1) {
//                        Don't search for other attributes with the same name if                         
//                        <saml:Attribute xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
//                             AttributeNamespace="http://schemas.xmlsoap.org/claims" AttributeName="roles">
//                        <saml:AttributeValue>Value1</saml:AttributeValue>
//                        <saml:AttributeValue>Value2</saml:AttributeValue>
//                        </saml:Attribute>
                        break;
                    }
                }
                
            }
        }
        return Collections.unmodifiableList(roles);
    }
 
Example #15
Source Project: lams   Author: lamsfoundation   File: ValidatorSuite.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Validates the given XMLObject. Does NOT validate its children.
 * 
 * @param xmlObject the XMLObject to validate.
 * 
 * @throws ValidationException thrown if the XMLObject does not validate
 */
private void performValidation(XMLObject xmlObject) throws ValidationException {
    QName schemaType = xmlObject.getSchemaType();
    if (schemaType != null) {
        log.debug("Validating XMLObject {} against validators registered under its schema type {}", xmlObject
                .getElementQName(), schemaType);
        performValidation(schemaType, xmlObject);
    }

    log.debug("Validating XMLObject {} against validators registered under its element QName", xmlObject
            .getElementQName());
    performValidation(xmlObject.getElementQName(), xmlObject);
}
 
Example #16
Source Project: lams   Author: lamsfoundation   File: UIInfoImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
    ArrayList<XMLObject> children = new ArrayList<XMLObject>();
    
    children.addAll(displayNames);
    children.addAll(descriptions);
    children.addAll(keywords);
    children.addAll(urls);
    children.addAll(logos);
    children.addAll(privacyStatementURLs);
    return children;
}
 
Example #17
Source Project: lams   Author: lamsfoundation   File: EnvironmentMatchTypeUnmarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    if (attribute.getLocalName().equals(EnvironmentMatchType.MATCH_ID_ATTRIB_NAME)) {
        EnvironmentMatchType matchType = (EnvironmentMatchType) xmlObject;
        matchType.setMatchId(DatatypeHelper.safeTrimOrNullString(attribute.getValue()));
    } else {
        super.processAttribute(xmlObject, attribute);
    }
}
 
Example #18
Source Project: lams   Author: lamsfoundation   File: CipherReferenceImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
    ArrayList<XMLObject> children = new ArrayList<XMLObject>();

    if (transforms != null) {
        children.add(transforms);
    }

    if (children.size() == 0) {
        return null;
    }

    return Collections.unmodifiableList(children);
}
 
Example #19
Source Project: lams   Author: lamsfoundation   File: AuthnRequestMarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
    AuthnRequest req = (AuthnRequest) samlObject;

    if (req.isForceAuthnXSBoolean() != null) {
        domElement.setAttributeNS(null, AuthnRequest.FORCE_AUTHN_ATTRIB_NAME, req.isForceAuthnXSBoolean()
                .toString());
    }

    if (req.isPassiveXSBoolean() != null) {
        domElement.setAttributeNS(null, AuthnRequest.IS_PASSIVE_ATTRIB_NAME, req.isPassiveXSBoolean().toString());
    }

    if (req.getProtocolBinding() != null) {
        domElement.setAttributeNS(null, AuthnRequest.PROTOCOL_BINDING_ATTRIB_NAME, req.getProtocolBinding());
    }

    if (req.getAssertionConsumerServiceIndex() != null) {
        domElement.setAttributeNS(null, AuthnRequest.ASSERTION_CONSUMER_SERVICE_INDEX_ATTRIB_NAME, req
                .getAssertionConsumerServiceIndex().toString());
    }

    if (req.getAssertionConsumerServiceURL() != null) {
        domElement.setAttributeNS(null, AuthnRequest.ASSERTION_CONSUMER_SERVICE_URL_ATTRIB_NAME, req
                .getAssertionConsumerServiceURL());
    }

    if (req.getAttributeConsumingServiceIndex() != null) {
        domElement.setAttributeNS(null, AuthnRequest.ATTRIBUTE_CONSUMING_SERVICE_INDEX_ATTRIB_NAME, req
                .getAttributeConsumingServiceIndex().toString());
    }

    if (req.getProviderName() != null) {
        domElement.setAttributeNS(null, AuthnRequest.PROVIDER_NAME_ATTRIB_NAME, req.getProviderName());
    }

    super.marshallAttributes(samlObject, domElement);
}
 
Example #20
Source Project: lams   Author: lamsfoundation   File: FunctionTypeMarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    FunctionType functionType = (FunctionType) xmlObject;
    if(!DatatypeHelper.isEmpty(functionType.getFunctionId())){
        domElement.setAttribute(FunctionType.FUNCTION_ID_ATTRIB_NAME,functionType.getFunctionId());
    }
}
 
Example #21
Source Project: carbon-identity   Author: wso2-attic   File: WSXACMLMessageReceiver.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create XMLObject from a given QName
 *
 * @param objectQName: QName of the object to be built into a XMLObject
 * @return built xmlObject
 * @throws EntitlementException
 */
private static XMLObject buildXMLObject(QName objectQName) throws EntitlementException {

    XMLObjectBuilder builder = org.opensaml.xml.Configuration.getBuilderFactory().getBuilder(objectQName);
    if (builder == null) {
        throw new EntitlementException("Unable to retrieve builder for object QName "
                + objectQName);
    }
    return builder.buildObject(objectQName.getNamespaceURI(), objectQName.getLocalPart(),
            objectQName.getPrefix());
}
 
Example #22
Source Project: lams   Author: lamsfoundation   File: AuthnContextDeclMarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    AuthnContextDecl authnCtxDecl = (AuthnContextDecl) xmlObject;

    Attr attribute;
    for (Entry<QName, String> entry : authnCtxDecl.getUnknownAttributes().entrySet()) {
        attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
        attribute.setValue(entry.getValue());
        domElement.setAttributeNodeNS(attribute);
        if (Configuration.isIDAttribute(entry.getKey())
                || authnCtxDecl.getUnknownAttributes().isIDAttribute(entry.getKey())) {
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        }
    }
}
 
Example #23
Source Project: lams   Author: lamsfoundation   File: AuthenticationStatementUnmarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    AuthenticationStatement authenticationStatement = (AuthenticationStatement) samlObject;

    if (AuthenticationStatement.AUTHENTICATIONINSTANT_ATTRIB_NAME.equals(attribute.getLocalName())
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        DateTime value = new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC());
        authenticationStatement.setAuthenticationInstant(value);
    } else if (AuthenticationStatement.AUTHENTICATIONMETHOD_ATTRIB_NAME.equals(attribute.getLocalName())) {
        authenticationStatement.setAuthenticationMethod(attribute.getValue());
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
Example #24
Source Project: lams   Author: lamsfoundation   File: SubjectTypeUnmarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
    SubjectType subject = (SubjectType) parentObject;
    if (childObject instanceof AttributeType) {
        subject.getAttributes().add((AttributeType) childObject);
    } else {
        super.processChildElement(parentObject, childObject);
    }
}
 
Example #25
Source Project: lams   Author: lamsfoundation   File: UseKeyUnmarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    UseKey uk = (UseKey) xmlObject;
    
    if (UseKey.SIG_ATTRIB_NAME.equals(attribute.getLocalName())) {
        uk.setSig(attribute.getValue());
    } else {
        super.processAttribute(xmlObject, attribute);
    }
}
 
Example #26
Source Project: lams   Author: lamsfoundation   File: ServiceDescriptionMarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
    ServiceDescription description = (ServiceDescription) samlObject;

    if (description.getDescription() != null) {
        XMLHelper.appendTextContent(domElement, description.getDescription().getLocalString());
    }
}
 
Example #27
Source Project: lams   Author: lamsfoundation   File: RuleCombinerParametersTypeUnmarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
        throws UnmarshallingException {
    RuleCombinerParametersType ruleCombinerParametersType = (RuleCombinerParametersType) parentXMLObject;
    
    if(childXMLObject instanceof CombinerParameterType){
        ruleCombinerParametersType.getCombinerParameters().add((CombinerParameterType)childXMLObject);
    } else {
        super.processChildElement(parentXMLObject, childXMLObject);
    }
}
 
Example #28
Source Project: lams   Author: lamsfoundation   File: XMLAttributeHelper.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds a <code>xml:base</code> attribute to the given XML object.
 * 
 * @param xmlObject the XML object to which to add the attribute
 * @param base the base value
 */
public static void addXMLBase(XMLObject xmlObject, String base) {
    if (xmlObject instanceof BaseBearing) {
        ((BaseBearing)xmlObject).setXMLBase(base);
    } else if (xmlObject instanceof AttributeExtensibleXMLObject) {
        ((AttributeExtensibleXMLObject)xmlObject).getUnknownAttributes()
            .put(BaseBearing.XML_BASE_ATTR_NAME, base);
    } else {
        throw new IllegalArgumentException("Specified object was neither BaseBearing nor AttributeExtensible");
    }
}
 
Example #29
Source Project: lams   Author: lamsfoundation   File: DetailMarshaller.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    Detail detail = (Detail) xmlObject;

    Attr attribute;
    for (Entry<QName, String> entry : detail.getUnknownAttributes().entrySet()) {
        attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
        attribute.setValue(entry.getValue());
        domElement.setAttributeNodeNS(attribute);
        if (Configuration.isIDAttribute(entry.getKey()) 
                || detail.getUnknownAttributes().isIDAttribute(entry.getKey())) {
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        }
    }
}
 
Example #30
Source Project: lams   Author: lamsfoundation   File: SignChallengeTypeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
    List<XMLObject> children = new ArrayList<XMLObject>();
    if (challenge != null) {
        children.add(challenge);
    }
    children.addAll(unknownChildren);
    return Collections.unmodifiableList(children);
}