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


Java Element.setAttributeNodeNS方法代码示例

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


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

示例1: declareExtensionNamespace

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Adds the specified namespace URI to the jaxb:extensionBindingPrefixes
 * attribute of the target document.
 */
private void declareExtensionNamespace( Element target, String nsUri ) {
    // look for the attribute
    Element root = target.getOwnerDocument().getDocumentElement();
    Attr att = root.getAttributeNodeNS(Const.JAXB_NSURI,EXTENSION_PREFIXES);
    if( att==null ) {
        String jaxbPrefix = allocatePrefix(root,Const.JAXB_NSURI);
        // no such attribute. Create one.
        att = target.getOwnerDocument().createAttributeNS(
            Const.JAXB_NSURI,jaxbPrefix+':'+EXTENSION_PREFIXES);
        root.setAttributeNodeNS(att);
    }

    String prefix = allocatePrefix(root,nsUri);
    if( att.getValue().indexOf(prefix)==-1 )
        // avoid redeclaring the same namespace twice.
        att.setValue( att.getValue()+' '+prefix);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:Internalizer.java

示例2: 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

示例3: marshallAttributes

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

    if(!DatatypeHelper.isEmpty(attributeValue.getDataType())){
    	domElement.setAttributeNS(null,AttributeAssignmentType.DATA_TYPE_ATTRIB_NAME, attributeValue.getDataType());
    }
    
    Attr attribute;
    for (Entry<QName, String> entry : attributeValue.getUnknownAttributes().entrySet()) {
        attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
        attribute.setValue(entry.getValue());
        domElement.setAttributeNodeNS(attribute);
        if (Configuration.isIDAttribute(entry.getKey())
                || attributeValue.getUnknownAttributes().isIDAttribute(entry.getKey())) {
            attribute.getOwnerElement().setIdAttributeNode(attribute, true);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:AttributeValueTypeMarshaller.java

示例4: marshallAttributes

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

    if (person.getType() != null) {
        domElement.setAttributeNS(null, ContactPerson.CONTACT_TYPE_ATTRIB_NAME, person.getType().toString());
    }

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

示例5: createAndAppendAttribute

import org.w3c.dom.Element; //导入方法依赖的package包/类
private Attr createAndAppendAttribute(
    @NotNull final Element owner,
    @NotNull final Attributes attrs,
    final int idx
) {
    final String localName = attrs.getLocalName(idx);
    final Attr result;
    if (StringUtil.isEmpty(localName)) {
        result = this.myDoc.createAttribute(attrs.getQName(idx));
        owner.setAttributeNode(result);
    } else {
        result = this.myDoc.createAttributeNS(attrs.getURI(idx), localName);
        owner.setAttributeNodeNS(result);
    }
    return result;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:ValidateContextImpl.java

示例6: marshallAttributes

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

    if (logo.getXMLLang() != null) {
        Attr attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), SAMLConstants.XML_NS,
                LangBearing.XML_LANG_ATTR_LOCAL_NAME, SAMLConstants.XML_PREFIX);
        attribute.setValue(logo.getXMLLang());
        domElement.setAttributeNodeNS(attribute);
    }
    if (logo.getHeight() != null) {
        domElement.setAttributeNS(null, Logo.HEIGHT_ATTR_NAME, logo.getHeight().toString());
    }
    if (logo.getWidth() != null) {
        domElement.setAttributeNS(null, Logo.WIDTH_ATTR_NAME, logo.getWidth().toString());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:LogoMarshaller.java

示例7: marshallAttributes

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

    if (subjectCD.getNotBefore() != null) {
        String notBeforeStr = Configuration.getSAMLDateFormatter().print(subjectCD.getNotBefore());
        domElement.setAttributeNS(null, SubjectConfirmationData.NOT_BEFORE_ATTRIB_NAME, notBeforeStr);
    }

    if (subjectCD.getNotOnOrAfter() != null) {
        String notOnOrAfterStr = Configuration.getSAMLDateFormatter().print(subjectCD.getNotOnOrAfter());
        domElement.setAttributeNS(null, SubjectConfirmationData.NOT_ON_OR_AFTER_ATTRIB_NAME, notOnOrAfterStr);
    }

    if (subjectCD.getRecipient() != null) {
        domElement.setAttributeNS(null, SubjectConfirmationData.RECIPIENT_ATTRIB_NAME, subjectCD.getRecipient());
    }

    if (subjectCD.getInResponseTo() != null) {
        domElement.setAttributeNS(null, SubjectConfirmationData.IN_RESPONSE_TO_ATTRIB_NAME, subjectCD
                .getInResponseTo());
    }

    if (subjectCD.getAddress() != null) {
        domElement.setAttributeNS(null, SubjectConfirmationData.ADDRESS_ATTRIB_NAME, subjectCD.getAddress());
    }

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

示例8: marshallAttributes

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

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

示例9: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@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);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:DetailMarshaller.java

示例10: marshallAttributes

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

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

示例11: marshallAttributeMap

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Marshall the attributes represented by the indicated AttributeMap into the indicated DOM Element.
 * 
 * @param attributeMap the AttributeMap
 * @param domElement the target Element
 */
public static void marshallAttributeMap(AttributeMap attributeMap, Element domElement) {
    Document document = domElement.getOwnerDocument();
    Attr attribute = null;
    for (Entry<QName, String> entry : attributeMap.entrySet()) {
        attribute = XMLHelper.constructAttribute(document, entry.getKey());
        attribute.setValue(entry.getValue());
        domElement.setAttributeNodeNS(attribute);
        if (Configuration.isIDAttribute(entry.getKey()) || attributeMap.isIDAttribute(entry.getKey())) {
            domElement.setIdAttributeNode(attribute, true);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:XMLHelper.java

示例12: marshallAttributes

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

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

示例13: marshallAttributes

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

    if (name.getURI() != null) {
        Attr attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), SAMLConstants.XML_NS,
                LangBearing.XML_LANG_ATTR_LOCAL_NAME, SAMLConstants.XML_PREFIX);
        attribute.setValue(name.getURI().getLanguage());
        domElement.setAttributeNodeNS(attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:LocalizedURIMarshaller.java

示例14: marshallAttributes

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

    if (attribute.getName() != null) {
        domElement.setAttributeNS(null, Attribute.NAME_ATTTRIB_NAME, attribute.getName());
    }

    if (attribute.getNameFormat() != null) {
        domElement.setAttributeNS(null, Attribute.NAME_FORMAT_ATTRIB_NAME, attribute.getNameFormat());
    }

    if (attribute.getFriendlyName() != null) {
        domElement.setAttributeNS(null, Attribute.FRIENDLY_NAME_ATTRIB_NAME, attribute.getFriendlyName());
    }

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

示例15: marshallAttributes

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

    if (name.getName() != null) {
        Attr attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), SAMLConstants.XML_NS,
                LangBearing.XML_LANG_ATTR_LOCAL_NAME, SAMLConstants.XML_PREFIX);
        attribute.setValue(name.getName().getLanguage());
        domElement.setAttributeNodeNS(attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:LocalizedNameMarshaller.java


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