Java Code Examples for org.opensaml.xml.util.XMLHelper#constructQName()

The following examples show how to use org.opensaml.xml.util.XMLHelper#constructQName() . 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 File: PolicyReferenceUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    PolicyReference pr = (PolicyReference) xmlObject;

    QName uriName = new QName(PolicyReference.URI_ATTRIB_NAME);
    QName digestName = new QName(PolicyReference.DIGEST_ATTRIB_NAME);
    QName digestAlgorithmName = new QName(PolicyReference.DIGEST_ALGORITHM_ATTRIB_NAME);

    QName attribQName = 
        XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute .getPrefix());

    if (uriName.equals(attribQName)) {
        pr.setURI(attribute.getValue());
    } else if (digestName.equals(attribQName)) {
        pr.setDigest(attribute.getValue());
    } else if (digestAlgorithmName.equals(attribQName)) {
        pr.setDigestAlgorithm(attribute.getValue());
    } else {
        XMLHelper.unmarshallToAttributeMap(pr.getUnknownAttributes(), attribute);
    }
}
 
Example 2
Source File: PolicyUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    Policy policy = (Policy) xmlObject;
    
    QName nameQName = new QName(Policy.NAME_ATTRIB_NAME);
    
    QName attribQName = 
        XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
    
    if (nameQName.equals(attribQName)) {
        policy.setName(attribute.getValue());
    } else if (Policy.WSU_ID_ATTR_NAME.equals(attribQName)) {
        policy.setWSUId(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else {
        XMLHelper.unmarshallToAttributeMap(policy.getUnknownAttributes(), attribute);
    }
}
 
Example 3
Source File: AuthnContextDeclUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    AuthnContextDecl authnCtcDecl = (AuthnContextDecl) xmlObject;

    QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
            .getPrefix());

    if (attribute.isId()) {
        authnCtcDecl.getUnknownAttributes().registerID(attribQName);
    }

    authnCtcDecl.getUnknownAttributes().put(attribQName, attribute.getValue());
}
 
Example 4
Source File: XSAnyUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    XSAny xsAny = (XSAny) xmlObject;

    QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
            .getPrefix());

    if (attribute.isId()) {
        xsAny.getUnknownAttributes().registerID(attribQName);
    }

    xsAny.getUnknownAttributes().put(attribQName, attribute.getValue());
}
 
Example 5
Source File: AbstractExtensibleXMLObjectUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Unmarshalls the <code>xs:anyAttribute</code> attributes.
 * 
 * {@inheritDoc}
 */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    AttributeExtensibleXMLObject anyAttribute = (AttributeExtensibleXMLObject) xmlObject;
    QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
            .getPrefix());
    if (attribute.isId()) {
        anyAttribute.getUnknownAttributes().registerID(attribQName);
    }
    anyAttribute.getUnknownAttributes().put(attribQName, attribute.getValue());
}
 
Example 6
Source File: AbstractXMLObject.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param namespaceURI the namespace the element is in
 * @param elementLocalName the local name of the XML element this Object represents
 * @param namespacePrefix the prefix for the given namespace
 */
protected AbstractXMLObject(String namespaceURI, String elementLocalName, String namespacePrefix) {
    nsManager = new NamespaceManager(this);
    idIndex = new IDIndex(this);
    elementQname = XMLHelper.constructQName(namespaceURI, elementLocalName, namespacePrefix);
    if(namespaceURI != null){
        setElementNamespacePrefix(namespacePrefix);
    }
}
 
Example 7
Source File: EnvelopeUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    Envelope envelope = (Envelope) xmlObject;
    QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
            .getPrefix());
    if (attribute.isId()) {
        envelope.getUnknownAttributes().registerID(attribQName);
    }
    envelope.getUnknownAttributes().put(attribQName, attribute.getValue());
}
 
Example 8
Source File: BodyUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    Body body = (Body) xmlObject;
    QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
            .getPrefix());
    if (attribute.isId()) {
        body.getUnknownAttributes().registerID(attribQName);
    }
    body.getUnknownAttributes().put(attribQName, attribute.getValue());
}
 
Example 9
Source File: HeaderUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    Header header = (Header) xmlObject;
    QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
            .getPrefix());
    if (attribute.isId()) {
        header.getUnknownAttributes().registerID(attribQName);
    }
    header.getUnknownAttributes().put(attribQName, attribute.getValue());
}
 
Example 10
Source File: DetailUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    Detail detail = (Detail) xmlObject;
    QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
            .getPrefix());
    if (attribute.isId()) {
        detail.getUnknownAttributes().registerID(attribQName);
    }
    detail.getUnknownAttributes().put(attribQName, attribute.getValue());
}
 
Example 11
Source File: AttributedURIUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    AttributedURI attributedURI = (AttributedURI) xmlObject;
    
    QName attribQName = 
        XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
    if (AttributedURI.WSU_ID_ATTR_NAME.equals(attribQName)) {
        attributedURI.setWSUId(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else {
        XMLHelper.unmarshallToAttributeMap(attributedURI.getUnknownAttributes(), attribute);
    }
}
 
Example 12
Source File: SecurityTokenReferenceUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    SecurityTokenReference str = (SecurityTokenReference) xmlObject;
    
    QName attribQName = 
        XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
    if (SecurityTokenReference.WSU_ID_ATTR_NAME.equals(attribQName)) {
        str.setWSUId(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else if (SecurityTokenReference.WSSE_USAGE_ATTR_NAME.equals(attribQName)) {
        str.setWSSEUsages(XMLHelper.getAttributeValueAsList(attribute));
    } else {
        XMLHelper.unmarshallToAttributeMap(str.getUnknownAttributes(), attribute);
    }
}
 
Example 13
Source File: SignatureConfirmationUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    SignatureConfirmation sc = (SignatureConfirmation) xmlObject;
    
    QName attrName =
        XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
    if (SignatureConfirmation.WSU_ID_ATTR_NAME.equals(attrName)) {
        sc.setWSUId(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else if (SignatureConfirmation.VALUE_ATTRIB_NAME.equals(attribute.getLocalName())) {
        sc.setValue(attribute.getValue());
    } else {
        super.processAttribute(xmlObject, attribute);
    }
}
 
Example 14
Source File: UsernameTokenUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    UsernameToken token = (UsernameToken) xmlObject;
    
    QName attribQName = 
        XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
    if (UsernameToken.WSU_ID_ATTR_NAME.equals(attribQName)) {
        token.setWSUId(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else {
        XMLHelper.unmarshallToAttributeMap(token.getUnknownAttributes(), attribute);
    }
}
 
Example 15
Source File: TimestampUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    Timestamp timestamp = (Timestamp) xmlObject;
    
    QName attrName =
        XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
    if (Timestamp.WSU_ID_ATTR_NAME.equals(attrName)) {
        timestamp.setWSUId(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else {
        XMLHelper.unmarshallToAttributeMap(timestamp.getUnknownAttributes(), attribute);
    }
    
}
 
Example 16
Source File: AttributedStringUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    AttributedString attributedString = (AttributedString) xmlObject;
    
    QName attribQName = 
        XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
    if (AttributedString.WSU_ID_ATTR_NAME.equals(attribQName)) {
        attributedString.setWSUId(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else {
        XMLHelper.unmarshallToAttributeMap(attributedString.getUnknownAttributes(), attribute);
    }
}
 
Example 17
Source File: AttributedDateTimeUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    AttributedDateTime dateTime = (AttributedDateTime) xmlObject;
    
    QName attrName =
        XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute.getPrefix());
    if (AttributedDateTime.WSU_ID_ATTR_NAME.equals(attrName)) {
        dateTime.setWSUId(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else {
        XMLHelper.unmarshallToAttributeMap(dateTime.getUnknownAttributes(), attribute);
    }
}
 
Example 18
Source File: AbstractXMLObject.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the element QName.
 * 
 * @param elementQName the element's QName
 */
protected void setElementQName(QName elementQName) {
    this.elementQname = XMLHelper.constructQName(elementQName.getNamespaceURI(), elementQName.getLocalPart(),
            elementQName.getPrefix());
    getNamespaceManager().registerElementName(this.elementQname);
}
 
Example 19
Source File: AbstractXMLObjectUnmarshaller.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * This constructor supports checking a DOM Element to be unmarshalled, either element name or schema type, against
 * a given namespace/local name pair.
 * 
 * @deprecated no replacement
 * 
 * @param targetNamespaceURI the namespace URI of either the schema type QName or element QName of the elements this
 *            unmarshaller operates on
 * @param targetLocalName the local name of either the schema type QName or element QName of the elements this
 *            unmarshaller operates on
 */
protected AbstractXMLObjectUnmarshaller(String targetNamespaceURI, String targetLocalName) {
    targetQName = XMLHelper.constructQName(targetNamespaceURI, targetLocalName, null);

    xmlObjectBuilderFactory = Configuration.getBuilderFactory();
    unmarshallerFactory = Configuration.getUnmarshallerFactory();
}
 
Example 20
Source File: AbstractXMLObjectMarshaller.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * This constructor supports checking an XMLObject to be marshalled, either element name or schema type, against a
 * given namespace/local name pair.
 * 
 * @deprecated no replacement
 * 
 * @param targetNamespaceURI the namespace URI of either the schema type QName or element QName of the elements this
 *            unmarshaller operates on
 * @param targetLocalName the local name of either the schema type QName or element QName of the elements this
 *            unmarshaller operates on
 */
protected AbstractXMLObjectMarshaller(String targetNamespaceURI, String targetLocalName) {
    targetQName = XMLHelper.constructQName(targetNamespaceURI, targetLocalName, null);

    marshallerFactory = Configuration.getMarshallerFactory();
}