本文整理汇总了Java中org.opensaml.xml.util.XMLHelper.getNodeQName方法的典型用法代码示例。如果您正苦于以下问题:Java XMLHelper.getNodeQName方法的具体用法?Java XMLHelper.getNodeQName怎么用?Java XMLHelper.getNodeQName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensaml.xml.util.XMLHelper
的用法示例。
在下文中一共展示了XMLHelper.getNodeQName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
EncryptedHeader eh = (EncryptedHeader) xmlObject;
QName attrName = XMLHelper.getNodeQName(attribute);
if (EncryptedHeader.WSU_ID_ATTR_NAME.equals(attrName)) {
eh.setWSUId(attribute.getValue());
attribute.getOwnerElement().setIdAttributeNode(attribute, true);
} else if (EncryptedHeader.SOAP11_MUST_UNDERSTAND_ATTR_NAME.equals(attrName)) {
eh.setSOAP11MustUnderstand(XSBooleanValue.valueOf(attribute.getValue()));
} else if (EncryptedHeader.SOAP11_ACTOR_ATTR_NAME.equals(attrName)) {
eh.setSOAP11Actor(attribute.getValue());
} else if (EncryptedHeader.SOAP12_MUST_UNDERSTAND_ATTR_NAME.equals(attrName)) {
eh.setSOAP12MustUnderstand(XSBooleanValue.valueOf(attribute.getValue()));
} else if (EncryptedHeader.SOAP12_ROLE_ATTR_NAME.equals(attrName)) {
eh.setSOAP12Role(attribute.getValue());
} else if (EncryptedHeader.SOAP12_RELAY_ATTR_NAME.equals(attrName)) {
eh.setSOAP12Relay(XSBooleanValue.valueOf(attribute.getValue()));
} else {
super.processAttribute(xmlObject, attribute);
}
}
示例2: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
EncryptionProperty ep = (EncryptionProperty) xmlObject;
if (attribute.getLocalName().equals(EncryptionProperty.ID_ATTRIB_NAME)) {
ep.setID(attribute.getValue());
attribute.getOwnerElement().setIdAttributeNode(attribute, true);
} else if (attribute.getLocalName().equals(EncryptionProperty.TARGET_ATTRIB_NAME)) {
ep.setTarget(attribute.getValue());
} else {
QName attributeName = XMLHelper.getNodeQName(attribute);
if (attribute.isId()) {
ep.getUnknownAttributes().registerID(attributeName);
}
ep.getUnknownAttributes().put(attributeName, attribute.getValue());
}
}
示例3: buildXMLObject
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/**
* Constructs the XMLObject that the given DOM Element will be unmarshalled into. If the DOM element has an XML
* Schema type defined this method will attempt to retrieve an XMLObjectBuilder, from the factory given at
* construction time, using the schema type. If no schema type is present or no builder is registered with the
* factory for the schema type, the elements QName is used. Once the builder is found the XMLObject is create by
* invoking {@link XMLObjectBuilder#buildObject(String, String, String)}. Extending classes may wish to override
* this logic if more than just schema type or element name (e.g. element attributes or content) need to be used to
* determine which XMLObjectBuilder should be used to create the XMLObject.
*
* @param domElement the DOM Element the created XMLObject will represent
*
* @return the empty XMLObject that DOM Element can be unmarshalled into
*
* @throws UnmarshallingException thrown if there is now XMLObjectBuilder registered for the given DOM Element
*/
protected XMLObject buildXMLObject(Element domElement) throws UnmarshallingException {
if (log.isTraceEnabled()) {
log.trace("Building XMLObject for {}", XMLHelper.getNodeQName(domElement));
}
XMLObjectBuilder xmlObjectBuilder;
xmlObjectBuilder = xmlObjectBuilderFactory.getBuilder(domElement);
if (xmlObjectBuilder == null) {
xmlObjectBuilder = xmlObjectBuilderFactory.getBuilder(Configuration.getDefaultProviderQName());
if (xmlObjectBuilder == null) {
String errorMsg = "Unable to locate builder for " + XMLHelper.getNodeQName(domElement);
log.error(errorMsg);
throw new UnmarshallingException(errorMsg);
} else {
if (log.isTraceEnabled()) {
log.trace("No builder was registered for {} but the default builder {} was available, using it.",
XMLHelper.getNodeQName(domElement), xmlObjectBuilder.getClass().getName());
}
}
}
return xmlObjectBuilder.buildObject(domElement);
}
示例4: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
ContactPerson person = (ContactPerson) samlObject;
if (attribute.getLocalName().equals(ContactPerson.CONTACT_TYPE_ATTRIB_NAME)) {
if (ContactPersonTypeEnumeration.TECHNICAL.toString().equals(attribute.getValue())) {
person.setType(ContactPersonTypeEnumeration.TECHNICAL);
} else if (ContactPersonTypeEnumeration.SUPPORT.toString().equals(attribute.getValue())) {
person.setType(ContactPersonTypeEnumeration.SUPPORT);
} else if (ContactPersonTypeEnumeration.ADMINISTRATIVE.toString().equals(attribute.getValue())) {
person.setType(ContactPersonTypeEnumeration.ADMINISTRATIVE);
} else if (ContactPersonTypeEnumeration.BILLING.toString().equals(attribute.getValue())) {
person.setType(ContactPersonTypeEnumeration.BILLING);
} else if (ContactPersonTypeEnumeration.OTHER.toString().equals(attribute.getValue())) {
person.setType(ContactPersonTypeEnumeration.OTHER);
} else {
super.processAttribute(samlObject, attribute);
}
} else {
QName attribQName = XMLHelper.getNodeQName(attribute);
if (attribute.isId()) {
person.getUnknownAttributes().registerID(attribQName);
}
person.getUnknownAttributes().put(attribQName, attribute.getValue());
}
}
示例5: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
Endpoint endpoint = (Endpoint) samlObject;
if (attribute.getLocalName().equals(Endpoint.BINDING_ATTRIB_NAME)) {
endpoint.setBinding(attribute.getValue());
} else if (attribute.getLocalName().equals(Endpoint.LOCATION_ATTRIB_NAME)) {
endpoint.setLocation(attribute.getValue());
} else if (attribute.getLocalName().equals(Endpoint.RESPONSE_LOCATION_ATTRIB_NAME)) {
endpoint.setResponseLocation(attribute.getValue());
} else {
QName attribQName = XMLHelper.getNodeQName(attribute);
if (attribute.isId()) {
endpoint.getUnknownAttributes().registerID(attribQName);
}
endpoint.getUnknownAttributes().put(attribQName, attribute.getValue());
}
}
示例6: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
EntityDescriptor entityDescriptor = (EntityDescriptor) samlObject;
if (attribute.getLocalName().equals(EntityDescriptor.ENTITY_ID_ATTRIB_NAME)) {
entityDescriptor.setEntityID(attribute.getValue());
} else if (attribute.getLocalName().equals(EntityDescriptor.ID_ATTRIB_NAME)) {
entityDescriptor.setID(attribute.getValue());
attribute.getOwnerElement().setIdAttributeNode(attribute, true);
} else if (attribute.getLocalName().equals(TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME)
&& !DatatypeHelper.isEmpty(attribute.getValue())) {
entityDescriptor.setValidUntil(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
} else if (attribute.getLocalName().equals(CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME)) {
entityDescriptor.setCacheDuration(XMLHelper.durationToLong(attribute.getValue()));
} else {
QName attribQName = XMLHelper.getNodeQName(attribute);
if (attribute.isId()) {
entityDescriptor.getUnknownAttributes().registerID(attribQName);
}
entityDescriptor.getUnknownAttributes().put(attribQName, attribute.getValue());
}
}
示例7: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
Request request = (Request) samlObject;
QName attrName = XMLHelper.getNodeQName(attribute);
if (Request.SOAP11_MUST_UNDERSTAND_ATTR_NAME.equals(attrName)) {
request.setSOAP11MustUnderstand(XSBooleanValue.valueOf(attribute.getValue()));
} else if (Request.SOAP11_ACTOR_ATTR_NAME.equals(attrName)) {
request.setSOAP11Actor(attribute.getValue());
} else if (Request.IS_PASSIVE_NAME_ATTRIB_NAME.equals(attribute.getLocalName())) {
request.setPassive(XSBooleanValue.valueOf(attribute.getValue()));
} else if (Request.PROVIDER_NAME_ATTRIB_NAME.equals(attribute.getLocalName())) {
request.setProviderName(attribute.getValue());
} else {
super.processAttribute(samlObject, attribute);
}
}
示例8: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
SubjectConfirmationData subjectCD = (SubjectConfirmationData) samlObject;
if (attribute.getLocalName().equals(SubjectConfirmationData.NOT_BEFORE_ATTRIB_NAME)
&& !DatatypeHelper.isEmpty(attribute.getValue())) {
subjectCD.setNotBefore(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
} else if (attribute.getLocalName().equals(SubjectConfirmationData.NOT_ON_OR_AFTER_ATTRIB_NAME)
&& !DatatypeHelper.isEmpty(attribute.getValue())) {
subjectCD.setNotOnOrAfter(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
} else if (attribute.getLocalName().equals(SubjectConfirmationData.RECIPIENT_ATTRIB_NAME)) {
subjectCD.setRecipient(attribute.getValue());
} else if (attribute.getLocalName().equals(SubjectConfirmationData.IN_RESPONSE_TO_ATTRIB_NAME)) {
subjectCD.setInResponseTo(attribute.getValue());
} else if (attribute.getLocalName().equals(SubjectConfirmationData.ADDRESS_ATTRIB_NAME)) {
subjectCD.setAddress(attribute.getValue());
} else {
QName attribQName = XMLHelper.getNodeQName(attribute);
if (attribute.isId()) {
subjectCD.getUnknownAttributes().registerID(attribQName);
}
subjectCD.getUnknownAttributes().put(attribQName, attribute.getValue());
}
}
示例9: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
Attribute attrib = (Attribute) samlObject;
if (attribute.getLocalName().equals(Attribute.NAME_ATTTRIB_NAME)) {
attrib.setName(attribute.getValue());
} else if (attribute.getLocalName().equals(Attribute.NAME_FORMAT_ATTRIB_NAME)) {
attrib.setNameFormat(attribute.getValue());
} else if (attribute.getLocalName().equals(Attribute.FRIENDLY_NAME_ATTRIB_NAME)) {
attrib.setFriendlyName(attribute.getValue());
} else {
QName attribQName = XMLHelper.getNodeQName(attribute);
if (attribute.isId()) {
attrib.getUnknownAttributes().registerID(attribQName);
}
attrib.getUnknownAttributes().put(attribQName, attribute.getValue());
}
}
示例10: checkElementIsTarget
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/**
* Checks that the given DOM Element's XSI type or namespace qualified element name matches the target QName of this
* unmarshaller.
*
* @param domElement the DOM element to check
*
* @throws UnmarshallingException thrown if the DOM Element does not match the target of this unmarshaller
*/
protected void checkElementIsTarget(Element domElement) throws UnmarshallingException {
QName elementName = XMLHelper.getNodeQName(domElement);
if (targetQName == null) {
log.trace(
"Targeted QName checking is not available for this unmarshaller, DOM Element {} was not verified",
elementName);
return;
}
log.trace("Checking that {} meets target criteria.", elementName);
QName type = XMLHelper.getXSIType(domElement);
if (type != null && type.equals(targetQName)) {
log.trace("{} schema type matches target.", elementName);
return;
} else {
if (elementName.equals(targetQName)) {
log.trace("{} element name matches target.", elementName);
return;
} else {
String errorMsg = "This unmarshaller only operates on " + targetQName + " elements not " + elementName;
log.error(errorMsg);
throw new UnmarshallingException(errorMsg);
}
}
}
示例11: unmarshallAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/**
* Unmarshalls the attributes from the given DOM Attr into the given XMLObject. If the attribute is an XML namespace
* declaration the attribute is passed to
* {@link AbstractXMLObjectUnmarshaller#unmarshallNamespaceAttribute(XMLObject, Attr)}. If it is an schema type
* decleration (xsi:type) it is ignored because this attribute is handled by {@link #buildXMLObject(Element)}. All
* other attributes are passed to the {@link #processAttribute(XMLObject, Attr)}
*
* @param attribute the attribute to be unmarshalled
* @param xmlObject the XMLObject that will recieve information from the DOM attribute
*
* @throws UnmarshallingException thrown if there is a problem unmarshalling an attribute
*/
protected void unmarshallAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
QName attribName = XMLHelper.getNodeQName(attribute);
log.trace("Pre-processing attribute {}", attribName);
String attributeNamespace = DatatypeHelper.safeTrimOrNullString(attribute.getNamespaceURI());
if (DatatypeHelper.safeEquals(attributeNamespace, XMLConstants.XMLNS_NS)) {
unmarshallNamespaceAttribute(xmlObject, attribute);
} else if (DatatypeHelper.safeEquals(attributeNamespace, XMLConstants.XSI_NS)) {
unmarshallSchemaInstanceAttributes(xmlObject, attribute);
} else {
if (log.isTraceEnabled()) {
log.trace("Attribute {} is neither a schema type nor namespace, calling processAttribute()",
XMLHelper.getNodeQName(attribute));
}
String attributeNSURI = attribute.getNamespaceURI();
String attributeNSPrefix;
if (attributeNSURI != null) {
attributeNSPrefix = attribute.lookupPrefix(attributeNSURI);
if (attributeNSPrefix == null && XMLConstants.XML_NS.equals(attributeNSURI)) {
attributeNSPrefix = XMLConstants.XML_PREFIX;
}
xmlObject.getNamespaceManager().registerAttributeName(attribName);
}
checkIDAttribute(attribute);
processAttribute(xmlObject, attribute);
}
}
示例12: unmarshallChildElement
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/**
* Unmarshalls given Element's children. For each child an unmarshaller is retrieved using
* {@link UnmarshallerFactory#getUnmarshaller(Element)}. The unmarshaller is then used to unmarshall the child
* element and the resultant XMLObject is passed to {@link #processChildElement(XMLObject, XMLObject)} for further
* processing.
*
* @param xmlObject the parent object of the unmarshalled children
* @param childElement the child element to be unmarshalled
*
* @throws UnmarshallingException thrown if an error occurs unmarshalling the chilren elements
*/
protected void unmarshallChildElement(XMLObject xmlObject, Element childElement) throws UnmarshallingException {
log.trace("Unmarshalling child elements of XMLObject {}", xmlObject.getElementQName());
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(childElement);
if (unmarshaller == null) {
unmarshaller = unmarshallerFactory.getUnmarshaller(Configuration.getDefaultProviderQName());
if (unmarshaller == null) {
String errorMsg = "No unmarshaller available for " + XMLHelper.getNodeQName(childElement)
+ ", child of " + xmlObject.getElementQName();
log.error(errorMsg);
throw new UnmarshallingException(errorMsg);
} else {
if (log.isTraceEnabled()) {
log.trace("No unmarshaller was registered for {}, child of {}. Using default unmarshaller.",
XMLHelper.getNodeQName(childElement), xmlObject.getElementQName());
}
}
}
if (log.isTraceEnabled()) {
log.trace("Unmarshalling child element {}with unmarshaller {}", XMLHelper.getNodeQName(childElement),
unmarshaller.getClass().getName());
}
processChildElement(xmlObject, unmarshaller.unmarshall(childElement));
}
示例13: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
AttributeValueType attributeValue = (AttributeValueType) xmlObject;
QName attribQName = XMLHelper.getNodeQName(attribute);
if (attribute.isId()) {
attributeValue.getUnknownAttributes().registerID(attribQName);
}
attributeValue.getUnknownAttributes().put(attribQName, attribute.getValue());
if(attribute.getLocalName().equals(AttributeValueType.DATA_TYPE_ATTRIB_NAME)){
attributeValue.setDataType(DatatypeHelper.safeTrimOrNullString(attribute.getValue()));
}
}
示例14: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
AttributeValueType attributeValue = (AttributeValueType) xmlObject;
QName attribQName = XMLHelper.getNodeQName(attribute);
if (attribute.isId()) {
attributeValue.getUnknownAttributes().registerID(attribQName);
}
attributeValue.getUnknownAttributes().put(attribQName, attribute.getValue());
}
示例15: processAttribute
import org.opensaml.xml.util.XMLHelper; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
ResourceContentType resourceContent = (ResourceContentType) xmlObject;
QName attribQName = XMLHelper.getNodeQName(attribute);
if (attribute.isId()) {
resourceContent.getUnknownAttributes().registerID(attribQName);
}
resourceContent.getUnknownAttributes().put(attribQName, attribute.getValue());
}