本文整理了Java中org.jdom.Element.getAttribute()
方法的一些代码示例,展示了Element.getAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getAttribute()
方法的具体详情如下:
包路径:org.jdom.Element
类名称:Element
方法名:getAttribute
[英]This returns the attribute for this element with the given name and within no namespace, or null if no such attribute exists.
[中]这将返回具有给定名称且不在名称空间内的该元素的属性,如果不存在此类属性,则返回null。
代码示例来源:origin: KronicDeth/intellij-elixir
@NotNull
@Override
public SdkProperties loadProperties(@Nullable Element propertiesElement) {
String erlangSdkName = null;
if (propertiesElement != null) {
@Nullable Attribute erlangSdkNameAttribute = propertiesElement.getAttribute("erlang-sdk-name");
if (erlangSdkNameAttribute != null) {
erlangSdkName = erlangSdkNameAttribute.getValue();
}
}
return new SdkProperties(erlangSdkName);
}
代码示例来源:origin: org.freemarker/freemarker
result.addAll(e.getAttributes());
} else {
Attribute attr = e.getAttribute(localName, Namespace.getNamespace("", namespaceUri));
if (attr != null) {
result.add(attr);
代码示例来源:origin: jaxen/jaxen
/**
* Retrieves an <code>Iterator</code> over the attribute elements that
* match the supplied name.
*
* @param contextNode the origin context node
* @param localName the local name of the attributes to return, always present
* @param namespacePrefix the prefix of the namespace of the attributes to return
* @param namespaceURI the URI of the namespace of the attributes to return
* @return an Iterator that traverses the named attributes, not null
*/
public Iterator getAttributeAxisIterator(
Object contextNode, String localName, String namespacePrefix, String namespaceURI) {
if ( contextNode instanceof Element ) {
Element node = (Element) contextNode;
Namespace namespace = (namespaceURI == null ? Namespace.NO_NAMESPACE :
Namespace.getNamespace(namespacePrefix, namespaceURI));
Attribute attr = node.getAttribute(localName, namespace);
if (attr != null) {
return new SingleObjectIterator(attr);
}
}
return JaxenConstants.EMPTY_ITERATOR;
}
代码示例来源:origin: kiegroup/optaplanner
dayOnRequest.setWeight(element.getAttribute("weight").getIntValue());
代码示例来源:origin: kiegroup/optaplanner
dayOffRequest.setWeight(element.getAttribute("weight").getIntValue());
代码示例来源:origin: kiegroup/optaplanner
shiftOnRequest.setWeight(element.getAttribute("weight").getIntValue());
代码示例来源:origin: kiegroup/optaplanner
shiftOffRequest.setWeight(element.getAttribute("weight").getIntValue());
代码示例来源:origin: kiegroup/optaplanner
Employee employee = new Employee();
employee.setId(id);
employee.setCode(element.getAttribute("ID").getValue());
employee.setName(element.getChild("Name").getText());
Element contractElement = element.getChild("ContractID");
代码示例来源:origin: kiegroup/optaplanner
NurseRoster nurseRoster = new NurseRoster();
nurseRoster.setId(0L);
nurseRoster.setCode(schedulingPeriodElement.getAttribute("ID").getValue());
代码示例来源:origin: kiegroup/optaplanner
int weight;
if (enabled) {
weight = element.getAttribute("weight").getIntValue();
if (weight < 0) {
throw new IllegalArgumentException("The weight (" + weight
代码示例来源:origin: org.freemarker/freemarker
if (node instanceof Element) {
Element element = (Element) node;
attr = element.getAttribute(localName, namespace);
} else if (node instanceof ProcessingInstruction) {
ProcessingInstruction pi = (ProcessingInstruction) node;
代码示例来源:origin: kiegroup/optaplanner
Element minElement, Element maxElement,
ContractLineType contractLineType) throws DataConversionException {
boolean minimumEnabled = minElement == null ? false : minElement.getAttribute("on").getBooleanValue();
int minimumWeight;
if (minimumEnabled) {
minimumWeight = minElement.getAttribute("weight").getIntValue();
if (minimumWeight < 0) {
throw new IllegalArgumentException("The minimumWeight (" + minimumWeight
minimumWeight = 0;
boolean maximumEnabled = maxElement == null ? false : maxElement.getAttribute("on").getBooleanValue();
int maximumWeight;
if (maximumEnabled) {
maximumWeight = maxElement.getAttribute("weight").getIntValue();
if (maximumWeight < 0) {
throw new IllegalArgumentException("The maximumWeight (" + maximumWeight
代码示例来源:origin: kiegroup/optaplanner
ShiftType shiftType = new ShiftType();
shiftType.setId(id);
shiftType.setCode(element.getAttribute("ID").getValue());
shiftType.setIndex(index);
String startTimeString = element.getChild("StartTime").getText();
代码示例来源:origin: kiegroup/optaplanner
Contract contract = new Contract();
contract.setId(id);
contract.setCode(element.getAttribute("ID").getValue());
contract.setDescription(element.getChild("Description").getText());
代码示例来源:origin: kiegroup/optaplanner
for (Element element : patternElementList) {
assertElementName(element, "Pattern");
String code = element.getAttribute("ID").getValue();
int weight = element.getAttribute("weight").getIntValue();
代码示例来源:origin: voldemort/voldemort
zoneReplicationFactor = new HashMap<Integer, Integer>();
for(Element node: (List<Element>) zoneReplicationFactorNode.getChildren(STORE_REPLICATION_FACTOR_ELMT)) {
int zone = Integer.parseInt(node.getAttribute(STORE_ZONE_ID_ELMT).getValue());
int repFactor = Integer.parseInt(node.getText());
zoneReplicationFactor.put(zone, repFactor);
代码示例来源:origin: rome/rome
protected Attribute getAttribute(Element e, String attributeName) {
Attribute attribute = e.getAttribute(attributeName);
if (attribute == null) {
attribute = e.getAttribute(attributeName, _namespace);
}
return attribute;
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public void cleanImport(Element node)
{
Attribute schemaLoc = node.getAttribute("schemaLocation");
// TODO: How do we make sure this is imported???
if (schemaLoc != null)
schemaLoc.detach();
}
代码示例来源:origin: org.wildfly.extras.patch/fuse-patch-config
public static Map<String, Element> mapByAttributeName(List<Element> elements, String attrName) {
LinkedHashMap<String, Element> rc = new LinkedHashMap<String, Element>();
for (Element element : elements) {
Attribute attribute = element.getAttribute(attrName);
if (attribute != null) {
rc.put(attribute.getValue(), element);
}
}
return rc;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private void updateJournalZblFingerprint(org.jdom.Element jmeta, YElement journal) {
// Try to update journal with zbl fingerprint
try {
org.jdom.Element jtitles = JDOMHelper.getChild(jmeta, "journal-title-group");
String journalAbbrev = JDOMHelper.getChildTextTrim(jtitles, "abbrev-journal-title");
String abrevType = JDOMHelper.getChild(jtitles, "abbrev-journal-title").getAttribute("abbrev-type").getValue().trim();
if ("short-title".equals(abrevType)) {
journal.addAttribute(ZentrallBlatSpecificAttributeTypes.AT_ZBL_JOURNAL_FINGERPRINT, journalAbbrev);
}
} catch (Exception e) {
}
}
内容来源于网络,如有侵权,请联系作者删除!