本文整理匯總了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);
}
}
示例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);
}
}
示例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 + ")");
}
}
示例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
);
}
}
示例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);
}
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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);
}
示例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;
}
示例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();
}
}
}