当前位置: 首页>>代码示例>>Java>>正文


Java Element.setIdAttributeNS方法代码示例

本文整理汇总了Java中org.w3c.dom.Element.setIdAttributeNS方法的典型用法代码示例。如果您正苦于以下问题:Java Element.setIdAttributeNS方法的具体用法?Java Element.setIdAttributeNS怎么用?Java Element.setIdAttributeNS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.w3c.dom.Element的用法示例。


在下文中一共展示了Element.setIdAttributeNS方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    EncryptionProperty ep = (EncryptionProperty) xmlObject;

    if (ep.getID() != null) {
        domElement.setAttributeNS(null, EncryptionProperty.ID_ATTRIB_NAME, ep.getID());
        domElement.setIdAttributeNS(null, EncryptionProperty.ID_ATTRIB_NAME, true);
    }
    if (ep.getTarget() != null) {
        domElement.setAttributeNS(null, EncryptionProperty.TARGET_ATTRIB_NAME, ep.getTarget());
    }

    Attr attribute;
    for (Entry<QName, String> entry : ep.getUnknownAttributes().entrySet()) {
        attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
        attribute.setValue(entry.getValue());
        domElement.setAttributeNodeNS(attribute);
        if (Configuration.isIDAttribute(entry.getKey()) || ep.getUnknownAttributes().isIDAttribute(entry.getKey())) {
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:EncryptionPropertyMarshaller.java

示例2: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    EncryptedType et = (EncryptedType) xmlObject;

    if (et.getID() != null) {
        domElement.setAttributeNS(null, EncryptedType.ID_ATTRIB_NAME, et.getID());
        domElement.setIdAttributeNS(null, EncryptedType.ID_ATTRIB_NAME, true);
    }

    if (et.getType() != null) {
        domElement.setAttributeNS(null, EncryptedType.TYPE_ATTRIB_NAME, et.getType());
    }

    if (et.getMimeType() != null) {
        domElement.setAttributeNS(null, EncryptedType.MIMETYPE_ATTRIB_NAME, et.getMimeType());
    }

    if (et.getEncoding() != null) {
        domElement.setAttributeNS(null, EncryptedType.ENCODING_ATTRIB_NAME, et.getEncoding());
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:EncryptedTypeMarshaller.java

示例3: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {
    RequestAbstractType request = (RequestAbstractType) samlElement;

    if (request.getID() != null) {
        domElement.setAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, request.getID());
        if (request.getMinorVersion() != 0) {
            domElement.setIdAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, true);
        }
    }

    if (request.getIssueInstant() != null) {
        String date = Configuration.getSAMLDateFormatter().print(request.getIssueInstant());
        domElement.setAttributeNS(null, RequestAbstractType.ISSUEINSTANT_ATTRIB_NAME, date);
    }
    if (request.getMinorVersion() != 0) {
        domElement.setAttributeNS(null, RequestAbstractType.MAJORVERSION_ATTRIB_NAME, "1");
        domElement.setAttributeNS(null, RequestAbstractType.MINORVERSION_ATTRIB_NAME, Integer.toString(request
                .getMinorVersion()));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:RequestAbstractTypeMarshaller.java

示例4: testCreateID

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Check if setting the attribute to be of type ID works. This will affect
 * the Attr.isID method according to the spec.
 *
 * @throws Exception If any errors occur.
 */
@Test
public void testCreateID() throws Exception {
    String xmlFile = XML_DIR + "accountInfo.xml";

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);

    Document document = dbf.newDocumentBuilder().parse(xmlFile);
    Element account = (Element)document
        .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0);

    account.setIdAttributeNS(PORTAL_ACCOUNT_NS, "accountID", true);
    Attr aID = account.getAttributeNodeNS(PORTAL_ACCOUNT_NS, "accountID");
    assertTrue(aID.isId());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:AuctionController.java

示例5: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
    Assertion assertion = (Assertion) samlObject;

    if (assertion.getVersion() != null) {
        domElement.setAttributeNS(null, Assertion.VERSION_ATTRIB_NAME, assertion.getVersion().toString());
    }

    if (assertion.getIssueInstant() != null) {
        String issueInstantStr = Configuration.getSAMLDateFormatter().print(assertion.getIssueInstant());
        domElement.setAttributeNS(null, Assertion.ISSUE_INSTANT_ATTRIB_NAME, issueInstantStr);
    }

    if (assertion.getID() != null) {
        domElement.setAttributeNS(null, Assertion.ID_ATTRIB_NAME, assertion.getID());
        domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME, true);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:AssertionMarshaller.java

示例6: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    KeyInfoReference ref = (KeyInfoReference) xmlObject;

    if (ref.getID() != null) {
        domElement.setAttributeNS(null, KeyInfoReference.ID_ATTRIB_NAME, ref.getID());
        domElement.setIdAttributeNS(null, KeyInfoReference.ID_ATTRIB_NAME, true);
    }

    if (ref.getURI() != null) {
        domElement.setAttributeNS(null, KeyInfoReference.URI_ATTRIB_NAME, ref.getURI());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:KeyInfoReferenceMarshaller.java

示例7: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    KeyInfoType keyInfo = (KeyInfoType) xmlObject;

    if (keyInfo.getID() != null) {
        domElement.setAttributeNS(null, KeyInfoType.ID_ATTRIB_NAME, keyInfo.getID());
        domElement.setIdAttributeNS(null, KeyInfoType.ID_ATTRIB_NAME, true);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:KeyInfoTypeMarshaller.java

示例8: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    DEREncodedKeyValue der = (DEREncodedKeyValue) xmlObject;

    if (der.getID() != null) {
        domElement.setAttributeNS(null, DEREncodedKeyValue.ID_ATTRIB_NAME, der.getID());
        domElement.setIdAttributeNS(null, DEREncodedKeyValue.ID_ATTRIB_NAME, true);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:DEREncodedKeyValueMarshaller.java

示例9: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    ECKeyValue ec = (ECKeyValue) xmlObject;

    if (ec.getID() != null) {
        domElement.setAttributeNS(null, ECKeyValue.ID_ATTRIB_NAME, ec.getID());
        domElement.setIdAttributeNS(null, ECKeyValue.ID_ATTRIB_NAME, true);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:ECKeyValueMarshaller.java

示例10: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    EncryptionProperties ep = (EncryptionProperties) xmlObject;

    if (ep.getID() != null) {
        domElement.setAttributeNS(null, EncryptionProperties.ID_ATTRIB_NAME, ep.getID());
        domElement.setIdAttributeNS(null, EncryptionProperties.ID_ATTRIB_NAME, true);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:EncryptionPropertiesMarshaller.java

示例11: unmarshall

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
public XMLObject unmarshall(Element domElement) throws UnmarshallingException {
    // After regular unmarshalling, check the minor version and set ID-ness if not SAML 1.0
    RequestAbstractType request = (RequestAbstractType) super.unmarshall(domElement);
    if (request.getMinorVersion() != 0 && !DatatypeHelper.isEmpty(request.getID())) {
        domElement.setIdAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, true);
    }
    return request;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:RequestAbstractTypeUnmarshaller.java

示例12: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {

    Assertion assertion = (Assertion) samlElement;

    if (assertion.getID() != null) {
        domElement.setAttributeNS(null, Assertion.ID_ATTRIB_NAME, assertion.getID());
        if (assertion.getMinorVersion() != 0) {
            domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME, true);
        }
    }

    if (assertion.getIssuer() != null) {
        domElement.setAttributeNS(null, Assertion.ISSUER_ATTRIB_NAME, assertion.getIssuer());
    }

    if (assertion.getIssueInstant() != null) {
        String date = ISODateTimeFormat.dateTime().print(assertion.getIssueInstant());
        domElement.setAttributeNS(null, Assertion.ISSUEINSTANT_ATTRIB_NAME, date);
    }

    domElement.setAttributeNS(null, Assertion.MAJORVERSION_ATTRIB_NAME, "1");
    if (assertion.getMinorVersion() == 0) {
        domElement.setAttributeNS(null, Assertion.MINORVERSION_ATTRIB_NAME, "0");
    } else {
        domElement.setAttributeNS(null, Assertion.MINORVERSION_ATTRIB_NAME, "1");
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:AssertionMarshaller.java

示例13: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlElement, Element domElement) {

    EntitiesDescriptor entitiesDescriptor = (EntitiesDescriptor) samlElement;

    // Set the ID attribute
    if (entitiesDescriptor.getID() != null) {
        log.debug("Writing ID attribute to EntitiesDescriptor DOM element.");
        domElement.setAttributeNS(null, EntitiesDescriptor.ID_ATTRIB_NAME, entitiesDescriptor.getID());
        domElement.setIdAttributeNS(null, EntitiesDescriptor.ID_ATTRIB_NAME, true);
    }

    // Set the validUntil attribute
    if (entitiesDescriptor.getValidUntil() != null) {
        log.debug("Writting validUntil attribute to EntitiesDescriptor DOM element");
        String validUntilStr = Configuration.getSAMLDateFormatter().print(entitiesDescriptor.getValidUntil());
        domElement.setAttributeNS(null, TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME, validUntilStr);
    }

    // Set the cacheDuration attribute
    if (entitiesDescriptor.getCacheDuration() != null) {
        log.debug("Writting cacheDuration attribute to EntitiesDescriptor DOM element");
        String cacheDuration = XMLHelper.longToDuration(entitiesDescriptor.getCacheDuration());
        domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
    }

    // Set the Name attribute
    if (entitiesDescriptor.getName() != null) {
        log.debug("Writting Name attribute to EntitiesDescriptor DOM element");
        domElement.setAttributeNS(null, EntitiesDescriptor.NAME_ATTRIB_NAME, entitiesDescriptor.getName());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:EntitiesDescriptorMarshaller.java

示例14: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {
    AffiliationDescriptor descriptor = (AffiliationDescriptor) samlElement;

    // Set affiliationOwnerID
    if (descriptor.getOwnerID() != null) {
        domElement.setAttributeNS(null, AffiliationDescriptor.OWNER_ID_ATTRIB_NAME, descriptor.getOwnerID());
    }

    // Set ID
    if (descriptor.getID() != null) {
        domElement.setAttributeNS(null, AffiliationDescriptor.ID_ATTRIB_NAME, descriptor.getID());
        domElement.setIdAttributeNS(null, AffiliationDescriptor.ID_ATTRIB_NAME, true);
    }

    // Set the validUntil attribute
    if (descriptor.getValidUntil() != null) {
        log.debug("Writting validUntil attribute to AffiliationDescriptor DOM element");
        String validUntilStr = Configuration.getSAMLDateFormatter().print(descriptor.getValidUntil());
        domElement.setAttributeNS(null, TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME, validUntilStr);
    }

    // Set the cacheDuration attribute
    if (descriptor.getCacheDuration() != null) {
        log.debug("Writting cacheDuration attribute to AffiliationDescriptor DOM element");
        String cacheDuration = XMLHelper.longToDuration(descriptor.getCacheDuration());
        domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
    }

    Attr attribute;
    for (Entry<QName, String> entry : descriptor.getUnknownAttributes().entrySet()) {
        attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
        attribute.setValue(entry.getValue());
        domElement.setAttributeNodeNS(attribute);
        if (Configuration.isIDAttribute(entry.getKey())
                || descriptor.getUnknownAttributes().isIDAttribute(entry.getKey())) {
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:AffiliationDescriptorMarshaller.java

示例15: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlElement, Element domElement) {
    EntityDescriptor entityDescriptor = (EntityDescriptor) samlElement;

    // Set the entityID attribute
    if (entityDescriptor.getEntityID() != null) {
        domElement.setAttributeNS(null, EntityDescriptor.ENTITY_ID_ATTRIB_NAME, entityDescriptor.getEntityID());
    }

    // Set the ID attribute
    if (entityDescriptor.getID() != null) {
        domElement.setAttributeNS(null, EntityDescriptor.ID_ATTRIB_NAME, entityDescriptor.getID());
        domElement.setIdAttributeNS(null, EntityDescriptor.ID_ATTRIB_NAME, true);
    }

    // Set the validUntil attribute
    if (entityDescriptor.getValidUntil() != null) {
        log.debug("Writting validUntil attribute to EntityDescriptor DOM element");
        String validUntilStr = Configuration.getSAMLDateFormatter().print(entityDescriptor.getValidUntil());
        domElement.setAttributeNS(null, TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME, validUntilStr);
    }

    // Set the cacheDuration attribute
    if (entityDescriptor.getCacheDuration() != null) {
        log.debug("Writting cacheDuration attribute to EntityDescriptor DOM element");
        String cacheDuration = XMLHelper.longToDuration(entityDescriptor.getCacheDuration());
        domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
    }

    Attr attribute;
    for (Entry<QName, String> entry : entityDescriptor.getUnknownAttributes().entrySet()) {
        attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
        attribute.setValue(entry.getValue());
        domElement.setAttributeNodeNS(attribute);
        if (Configuration.isIDAttribute(entry.getKey())
                || entityDescriptor.getUnknownAttributes().isIDAttribute(entry.getKey())) {
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:EntityDescriptorMarshaller.java


注:本文中的org.w3c.dom.Element.setIdAttributeNS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。