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


Java Attr.getValue方法代码示例

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


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

示例1: addDebugVMArgs

import org.w3c.dom.Attr; //导入方法依赖的package包/类
private void addDebugVMArgs(Element java, Document ownerDocument) {
    //Add fork="true" if not alredy there
    NamedNodeMap attrs = java.getAttributes();
    boolean found = false;
    for (int i=0; i<attrs.getLength(); i++) {
        Attr attr = (Attr) attrs.item(i);
        if ("fork".equals(attr.getName())) {        //NOI18N
            String value = attr.getValue();
            if ("on".equalsIgnoreCase (value) ||    //NOI18N
                "true".equalsIgnoreCase(value) ||   //NOI18N
                "yes".equalsIgnoreCase(value)) {    //NOI18N
                found = true;
            }
            break;
        }
    }
    if (!found) {
        java.setAttribute("fork", "true");  //NOI18N
    }
    for (int i = 0; i < DEBUG_VM_ARGS.length; i++) {
        Element jvmarg = ownerDocument.createElement("jvmarg"); // NOI18N
        jvmarg.setAttribute("value", DEBUG_VM_ARGS[i]); // NOI18N
        java.appendChild(jvmarg);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:JavaActions.java

示例2: processAttribute

import org.w3c.dom.Attr; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    AuthzDecisionStatement authzDS = (AuthzDecisionStatement) samlObject;

    if (attribute.getLocalName().equals(AuthzDecisionStatement.RESOURCE_ATTRIB_NAME)) {
        authzDS.setResource(attribute.getValue());
    } else if (attribute.getLocalName().equals(AuthzDecisionStatement.DECISION_ATTRIB_NAME)) {
        String value = attribute.getValue();
        if (value.equals(DecisionTypeEnumeration.PERMIT.toString())) {
            authzDS.setDecision(DecisionTypeEnumeration.PERMIT);
        } else if (value.equals(DecisionTypeEnumeration.DENY.toString())) {
            authzDS.setDecision(DecisionTypeEnumeration.DENY);
        } else if (value.equals(DecisionTypeEnumeration.INDETERMINATE.toString())) {
            authzDS.setDecision(DecisionTypeEnumeration.INDETERMINATE);
        } else {
            throw new UnmarshallingException("Unknown value for DecisionType '" + value + "'");
        }
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:AuthzDecisionStatementUnmarshaller.java

示例3: test2

import org.w3c.dom.Attr; //导入方法依赖的package包/类
public static void test2() {
    String name = "attr";
    String oldValue = "old value";
    String newValue = "new value";
    Attr retAttr;

    IIOMetadataNode parent = new IIOMetadataNode("parent");
    MyAttrNode attrNode1 = new MyAttrNode(name, oldValue);
    MyAttrNode attrNode2 = new MyAttrNode(name, newValue);

    retAttr = parent.setAttributeNode(attrNode1);
    retAttr = parent.setAttributeNode(attrNode2);

    String actName = retAttr.getNodeName();
    String actValue = retAttr.getValue();

    if (!actName.equals(name) || !actValue.equals(oldValue)) {
        throw new RuntimeException("Test 2 failed: Invalid attribute " +
                                   "returned: " +
                                   "(name: " + actName +
                                   ", value: " + actValue + ")");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:SetAttributeNode.java

示例4: assertNotRelativeNS

import org.w3c.dom.Attr; //导入方法依赖的package包/类
/**
 * This method throws an exception if the Attribute value contains
 * a relative URI.
 *
 * @param attr
 * @throws CanonicalizationException
 */
public static void assertNotRelativeNS(Attr attr) throws CanonicalizationException {
    if (attr == null) {
        return;
    }

    String nodeAttrName = attr.getNodeName();
    boolean definesDefaultNS = nodeAttrName.equals("xmlns");
    boolean definesNonDefaultNS = nodeAttrName.startsWith("xmlns:");

    if ((definesDefaultNS || definesNonDefaultNS) && namespaceIsRelative(attr)) {
        String parentName = attr.getOwnerElement().getTagName();
        String attrValue = attr.getValue();
        Object exArgs[] = { parentName, nodeAttrName, attrValue };

        throw new CanonicalizationException(
            "c14n.Canonicalizer.RelativeNamespace", exArgs
        );
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:C14nHelper.java

示例5: processAttribute

import org.w3c.dom.Attr; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {

    AuthorizationDecisionStatement authorizationDecisionStatement;
    authorizationDecisionStatement = (AuthorizationDecisionStatement) samlObject;

    if (AuthorizationDecisionStatement.DECISION_ATTRIB_NAME.equals(attribute.getLocalName())) {
        String value = attribute.getValue();
        if (value.equals(DecisionTypeEnumeration.PERMIT.toString())) {
            authorizationDecisionStatement.setDecision(DecisionTypeEnumeration.PERMIT);
        } else if (value.equals(DecisionTypeEnumeration.DENY.toString())) {
            authorizationDecisionStatement.setDecision(DecisionTypeEnumeration.DENY);
        } else if (value.equals(DecisionTypeEnumeration.INDETERMINATE.toString())) {
            authorizationDecisionStatement.setDecision(DecisionTypeEnumeration.INDETERMINATE);
        } else {
            log.error("Unknown value for DecisionType '" + value + "'");
            throw new UnmarshallingException("Unknown value for DecisionType '" + value + "'");
        }
    } else if (AuthorizationDecisionStatement.RESOURCE_ATTRIB_NAME.equals(attribute.getLocalName())) {
        authorizationDecisionStatement.setResource(attribute.getValue());
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:AuthorizationDecisionStatementUnmarshaller.java

示例6: process

import org.w3c.dom.Attr; //导入方法依赖的package包/类
public boolean process(Element parent, Attr attribute, BeanDefinitionBuilder builder) {
	String name = attribute.getLocalName();
	String value = attribute.getValue();

	if (AVAILABILITY.equals(name)) {
		builder.addPropertyValue(AVAILABILITY, ReferenceParsingUtil.determineAvailability(value));
		return false;
	}

	else if (COMPONENT_NAME.equals(name)) {
		builder.addPropertyValue(SERVICE_BEAN_NAME_PROP, value);
		return false;
	}

	return true;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:17,代码来源:BlueprintReferenceAttributeCallback.java

示例7: getAttributeNS

import org.w3c.dom.Attr; //导入方法依赖的package包/类
/**
 * Introduced in DOM Level 2. <p>
 *
 * Retrieves an attribute value by local name and namespace URI.
 *
 * @param namespaceURI
 *                      The namespace URI of the attribute to
 *                      retrieve.
 * @param localName     The local name of the attribute to retrieve.
 * @return String       The Attr value as a string, or empty string
 *                      if that attribute
 *                      does not have a specified or default value.
 * @since WD-DOM-Level-2-19990923
 */
public String getAttributeNS(String namespaceURI, String localName) {

    if (needsSyncData()) {
        synchronizeData();
    }

    if (attributes == null) {
        return "";
    }

    Attr attr = (Attr)(attributes.getNamedItemNS(namespaceURI, localName));
    return (attr == null) ? "" : attr.getValue();

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:ElementImpl.java

示例8: getAttributeNS

import org.w3c.dom.Attr; //导入方法依赖的package包/类
/**
 * Introduced in DOM Level 2.
 * <p>
 *
 * Retrieves an attribute value by local name and namespace URI.
 *
 * @param namespaceURI The namespace URI of the attribute to retrieve.
 * @param localName The local name of the attribute to retrieve.
 * @return String The Attr value as a string, or empty string if that
 * attribute does not have a specified or default value.
 * @since WD-DOM-Level-2-19990923
 */
public String getAttributeNS(String namespaceURI, String localName) {

    if (needsSyncData()) {
        synchronizeData();
    }

    if (attributes == null) {
        return "";
    }

    Attr attr = (Attr) (attributes.getNamedItemNS(namespaceURI, localName));
    return (attr == null) ? "" : attr.getValue();

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:ElementImpl.java

示例9: getAttribute

import org.w3c.dom.Attr; //导入方法依赖的package包/类
/**
 * Retrieves an attribute value by name.
 * @param name The name of the attribute to retrieve.
 * @return The <code>Attr</code> value as a string, or the empty string
 * if that attribute does not have a specified or default value.
 */
public String getAttribute(String name) {
    Attr attr = getAttributeNode(name);
    if (attr == null) {
        return "";
    }
    return attr.getValue();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:IIOMetadataNode.java

示例10: processAttribute

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

示例11: getName

import org.w3c.dom.Attr; //导入方法依赖的package包/类
/**
 * Returns the name of the resource based a node's attributes.
 * @param node the node.
 * @return the name or null if it could not be inferred.
 */
static String getName(Node node) {
    Attr attribute = (Attr) node.getAttributes().getNamedItemNS(null, ATTR_NAME);

    if (attribute != null) {
        return attribute.getValue();
    }

    return null;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:15,代码来源:ValueResourceParser2.java

示例12: getAttributeValueAsBoolean

import org.w3c.dom.Attr; //导入方法依赖的package包/类
/**
 * Parses the attribute's value. If the value is 0 or "false" then false is returned, if the value is 1 or "true"
 * then true is returned, if the value is anything else then null returned.
 * 
 * @param attribute attribute whose value will be converted to a boolean
 * 
 * @return boolean value of the attribute or null
 */
public static Boolean getAttributeValueAsBoolean(Attr attribute) {
    if (attribute == null) {
        return null;
    }

    String valueStr = attribute.getValue();
    if (valueStr.equals("0") || valueStr.equals("false")) {
        return Boolean.FALSE;
    } else if (valueStr.equals("1") || valueStr.equals("true")) {
        return Boolean.TRUE;
    } else {
        return null;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:XMLHelper.java

示例13: DOMManifest

import org.w3c.dom.Attr; //导入方法依赖的package包/类
/**
 * Creates a <code>DOMManifest</code> from an element.
 *
 * @param manElem a Manifest element
 */
public DOMManifest(Element manElem, XMLCryptoContext context,
                   Provider provider)
    throws MarshalException
{
    Attr attr = manElem.getAttributeNodeNS(null, "Id");
    if (attr != null) {
        this.id = attr.getValue();
        manElem.setIdAttributeNode(attr, true);
    } else {
        this.id = null;
    }

    boolean secVal = Utils.secureValidation(context);

    Element refElem = DOMUtils.getFirstChildElement(manElem, "Reference");
    List<Reference> refs = new ArrayList<Reference>();
    refs.add(new DOMReference(refElem, context, provider));

    refElem = DOMUtils.getNextSiblingElement(refElem);
    while (refElem != null) {
        String localName = refElem.getLocalName();
        if (!localName.equals("Reference")) {
            throw new MarshalException("Invalid element name: " +
                                       localName + ", expected Reference");
        }
        refs.add(new DOMReference(refElem, context, provider));
        if (secVal && (refs.size() > DOMSignedInfo.MAXIMUM_REFERENCE_COUNT)) {
            String error = "A maxiumum of " + DOMSignedInfo.MAXIMUM_REFERENCE_COUNT + " "
                + "references per Manifest are allowed with secure validation";
            throw new MarshalException(error);
        }
        refElem = DOMUtils.getNextSiblingElement(refElem);
    }
    this.references = Collections.unmodifiableList(refs);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:DOMManifest.java

示例14: getAttributeValue

import org.w3c.dom.Attr; //导入方法依赖的package包/类
@Nullable
private static String getAttributeValue(NamedNodeMap attributes, String attributeName) {
    Attr attribute = (Attr) attributes.getNamedItem(attributeName);
    if (attribute != null) {
        return attribute.getValue();
    }

    return null;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:10,代码来源:ResourceItem.java

示例15: fillNamespaceContext

import org.w3c.dom.Attr; //导入方法依赖的package包/类
private void fillNamespaceContext() {
    if (fRoot != null) {
        Node currentNode = fRoot.getParentNode();
        while (currentNode != null) {
            if (Node.ELEMENT_NODE == currentNode.getNodeType()) {
                NamedNodeMap attributes = currentNode.getAttributes();
                final int attrCount = attributes.getLength();
                for (int i = 0; i < attrCount; ++i) {
                    Attr attr = (Attr) attributes.item(i);
                    String value = attr.getValue();
                    if (value == null) {
                        value = XMLSymbols.EMPTY_STRING;
                    }
                    fillQName(fAttributeQName, attr);
                    // REVISIT: Should we be looking at non-namespace attributes
                    // for additional mappings? Should we detect illegal namespace
                    // declarations and exclude them from the context? -- mrglavas
                    if (fAttributeQName.uri == NamespaceContext.XMLNS_URI) {
                        // process namespace attribute
                        if (fAttributeQName.prefix == XMLSymbols.PREFIX_XMLNS) {
                            declarePrefix0(fAttributeQName.localpart, value.length() != 0 ? fSymbolTable.addSymbol(value) : null);
                        }
                        else {
                            declarePrefix0(XMLSymbols.EMPTY_STRING, value.length() != 0 ? fSymbolTable.addSymbol(value) : null);
                        }
                    }
                }

            }
            currentNode = currentNode.getParentNode();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:DOMValidatorHelper.java


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