本文整理了Java中org.jdom.Element.getText()
方法的一些代码示例,展示了Element.getText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getText()
方法的具体详情如下:
包路径:org.jdom.Element
类名称:Element
方法名:getText
[英]Returns the textual content directly held under this element as a string. This includes all text within this single element, including whitespace and CDATA sections if they exist. It's essentially the concatenation of all Text and CDATA nodes returned by #getContent. The call does not recurse into child elements. If no textual value exists for the element, an empty string is returned.
[中]以字符串形式返回直接保存在此元素下的文本内容。这包括单个元素中的所有文本,包括空格和CDATA部分(如果存在)。它本质上是#getContent返回的所有文本和CDATA节点的串联。调用不会递归到子元素中。如果元素不存在文本值,则返回空字符串。
代码示例来源:origin: voldemort/voldemort
public static SerializerDefinition readSerializer(Element elmt) {
String name = elmt.getChild(STORE_SERIALIZATION_TYPE_ELMT).getText();
boolean hasVersion = true;
Map<Integer, String> schemaInfosByVersion = new HashMap<Integer, String>();
version = Integer.parseInt(versionStr);
String info = schemaInfoElmt.getText();
String previous = schemaInfosByVersion.put(version, info);
if(previous != null)
throw new IllegalArgumentException("Specified multiple schemas AND version=none, which is not permitted.");
Element compressionElmt = elmt.getChild(STORE_COMPRESSION_ELMT);
Compression compression = null;
if(compressionElmt != null)
代码示例来源:origin: kiegroup/optaplanner
for (Element element : coverRequirementElementList) {
if (element.getName().equals("DayOfWeekCover")) {
Element dayOfWeekElement = element.getChild("Day");
DayOfWeek dayOfWeek = null;
for (DayOfWeek possibleDayOfWeek : DayOfWeek.values()) {
if (possibleDayOfWeek.name().equalsIgnoreCase(dayOfWeekElement.getText())) {
dayOfWeek = possibleDayOfWeek;
break;
throw new IllegalArgumentException("The dayOfWeek (" + dayOfWeekElement.getText()
+ ") of an entity DayOfWeekCover does not exist.");
Element shiftTypeElement = coverElement.getChild("Shift");
ShiftType shiftType = shiftTypeMap.get(shiftTypeElement.getText());
if (shiftType == null) {
if (shiftTypeElement.getText().equals("Any")) {
throw new IllegalStateException("The shiftType Any is not supported on DayOfWeekCover.");
} else if (shiftTypeElement.getText().equals("None")) {
throw new IllegalStateException("The shiftType None is not supported on DayOfWeekCover.");
} else {
throw new IllegalArgumentException("The shiftType (" + shiftTypeElement.getText()
+ ") of an entity DayOfWeekCover does not exist.");
List<Shift> shiftList = dayOfWeekAndShiftTypeToShiftListMap.get(key);
if (shiftList == null) {
throw new IllegalArgumentException("The dayOfWeek (" + dayOfWeekElement.getText()
+ ") with the shiftType (" + shiftTypeElement.getText()
+ ") of an entity DayOfWeekCover does not have any shifts.");
代码示例来源:origin: JetBrains/ideavim
public void readData(@NotNull Element element) {
logger.debug("readData");
Element search = element.getChild("search");
if (search == null) {
return;
}
lastSearch = getSafeChildText(search, "last-search");
lastOffset = getSafeChildText(search, "last-offset");
lastPattern = getSafeChildText(search, "last-pattern");
lastReplace = getSafeChildText(search, "last-replace");
lastSubstitute = getSafeChildText(search, "last-substitute");
Element dir = search.getChild("last-dir");
lastDir = Integer.parseInt(dir.getText());
Element show = search.getChild("show-last");
final ListOption vimInfo = Options.getInstance().getListOption(Options.VIMINFO);
final boolean disableHighlight = vimInfo != null && vimInfo.contains("h");
showSearchHighlight = !disableHighlight && Boolean.valueOf(show.getText());
if (logger.isDebugEnabled()) {
logger.debug("show=" + show + "(" + show.getText() + ")");
logger.debug("showSearchHighlight=" + showSearchHighlight);
}
}
代码示例来源:origin: voldemort/voldemort
viewSerializerFactoryName = store.getChild(VIEW_SERIALIZER_FACTORY_ELMT).getText();
if(store.getChild(STORE_VALUE_SERIALIZER_ELMT) != null)
valueSerializer = readSerializer(store.getChild(STORE_VALUE_SERIALIZER_ELMT));
代码示例来源:origin: hsz/idea-gitignore
/**
* Loads {@link UserTemplate} objects from the {@link Element}.
*
* @param element source
* @return {@link UserTemplate} list
*/
@NotNull
public static List<UserTemplate> loadTemplates(@NotNull Element element) {
final String key = KEY.USER_TEMPLATES.toString();
final List<UserTemplate> list = ContainerUtil.newArrayList();
if (!key.equals(element.getName())) {
element = element.getChild(key);
}
for (Element template : element.getChildren()) {
list.add(new UserTemplate(
template.getAttributeValue(KEY.USER_TEMPLATES_NAME.toString()),
template.getText()
));
}
return list;
}
代码示例来源:origin: banq/jdonframework
element = element.getChild(propName[i]);
if (element == null) {
String value = element.getText();
if ("".equals(value)) {
return null;
代码示例来源:origin: voldemort/voldemort
Element zoneReplicationFactorNode = store.getChild(STORE_ZONE_REPLICATION_FACTOR_ELMT);
if(zoneReplicationFactorNode != null) {
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);
Integer retentionFreqDays = null;
if(retention != null) {
int retentionDays = Integer.parseInt(retention.getText());
if(retentionDays > 0) {
retentionPolicyDays = retentionDays;
Element throttleRate = store.getChild(STORE_RETENTION_SCAN_THROTTLE_RATE_ELMT);
if(throttleRate != null)
retentionThrottleRate = Integer.parseInt(throttleRate.getText());
Element retentionFreqDaysElement = store.getChild(STORE_RETENTION_FREQ_ELMT);
if(retentionFreqDaysElement != null)
retentionFreqDays = Integer.parseInt(retentionFreqDaysElement.getText());
} else {
logger.error("Invalid retention policy days set. Should be greater than zero. ignoring value "
代码示例来源:origin: kiegroup/optaplanner
shiftOffRequest.setId(id);
Element employeeElement = element.getChild("EmployeeID");
Employee employee = employeeMap.get(employeeElement.getText());
if (employee == null) {
throw new IllegalArgumentException("The shift (" + employeeElement.getText()
+ ") of shiftOffRequest (" + shiftOffRequest + ") does not exist.");
Element dateElement = element.getChild("Date");
Element shiftTypeElement = element.getChild("ShiftTypeID");
LocalDate date = LocalDate.parse(dateElement.getText(), DateTimeFormatter.ISO_DATE);
Shift shift = dateAndShiftTypeToShiftMap.get(Pair.of(date, shiftTypeElement.getText()));
if (shift == null) {
throw new IllegalArgumentException("The date (" + dateElement.getText()
+ ") or the shiftType (" + shiftTypeElement.getText()
+ ") of shiftOffRequest (" + shiftOffRequest + ") does not exist.");
代码示例来源:origin: com.atlassian.theplugin/atlassian-plugin-commons
private String getChildText(Element node, String childName) {
try {
return node.getChild(childName).getText();
} catch (Exception e) {
return "";
}
}
代码示例来源:origin: net.anotheria/ano-doc
@SuppressWarnings("unchecked")
private static Context parseLanguages(Context src, Element languages){
src.enableMultiLanguageSupport();
Element supportedLanguages = languages.getChild("supported");
List<Element> supLangs = supportedLanguages.getChildren("language");
for (Element e: supLangs){
src.addLanguage(e.getText());
}
String defLang = languages.getChild("default").getChildText("language");
src.setDefaultLanguage(defLang);
return src;
}
代码示例来源:origin: kiegroup/optaplanner
shiftOnRequest.setId(id);
Element employeeElement = element.getChild("EmployeeID");
Employee employee = employeeMap.get(employeeElement.getText());
if (employee == null) {
throw new IllegalArgumentException("The shift (" + employeeElement.getText()
+ ") of shiftOnRequest (" + shiftOnRequest + ") does not exist.");
Element dateElement = element.getChild("Date");
Element shiftTypeElement = element.getChild("ShiftTypeID");
LocalDate date = LocalDate.parse(dateElement.getText(), DateTimeFormatter.ISO_DATE);
Shift shift = dateAndShiftTypeToShiftMap.get(Pair.of(date, shiftTypeElement.getText()));
if (shift == null) {
throw new IllegalArgumentException("The date (" + dateElement.getText()
+ ") or the shiftType (" + shiftTypeElement.getText()
+ ") of shiftOnRequest (" + shiftOnRequest + ") does not exist.");
代码示例来源:origin: com.atlassian.theplugin/atlassian-plugin-commons
public static String getChildText(Element node, String childName) {
try {
return node.getChild(childName).getText();
} catch (Exception e) {
return "";
}
}
代码示例来源:origin: kiegroup/optaplanner
dayOnRequest.setId(id);
Element employeeElement = element.getChild("EmployeeID");
Employee employee = employeeMap.get(employeeElement.getText());
if (employee == null) {
throw new IllegalArgumentException("The shiftDate (" + employeeElement.getText()
+ ") of dayOnRequest (" + dayOnRequest + ") does not exist.");
Element dateElement = element.getChild("Date");
ShiftDate shiftDate = shiftDateMap.get(LocalDate.parse(dateElement.getText(), DateTimeFormatter.ISO_DATE));
if (shiftDate == null) {
throw new IllegalArgumentException("The date (" + dateElement.getText()
+ ") of dayOnRequest (" + dayOnRequest + ") does not exist.");
代码示例来源:origin: edu.washington.cs.knowitall/nlp
/***
* Constructs a pattern expression from an element.
* @param e
* @return
*/
protected String deserializePattern(Element e) {
return e.getChild("pattern").getText();
}
代码示例来源:origin: kiegroup/optaplanner
dayOffRequest.setId(id);
Element employeeElement = element.getChild("EmployeeID");
Employee employee = employeeMap.get(employeeElement.getText());
if (employee == null) {
throw new IllegalArgumentException("The shiftDate (" + employeeElement.getText()
+ ") of dayOffRequest (" + dayOffRequest + ") does not exist.");
Element dateElement = element.getChild("Date");
ShiftDate shiftDate = shiftDateMap.get(LocalDate.parse(dateElement.getText(), DateTimeFormatter.ISO_DATE));
if (shiftDate == null) {
throw new IllegalArgumentException("The date (" + dateElement.getText()
+ ") of dayOffRequest (" + dayOffRequest + ") does not exist.");
代码示例来源:origin: miltonio/milton2
public static String asString( Element el, String name ) {
Element elChild = el.getChild( name, NS_DAV );
if( elChild == null ) {
//log.debug("No child: " + name + " of " + el.getName());
return null;
}
return elChild.getText();
}
代码示例来源:origin: kiegroup/optaplanner
employee.setId(id);
employee.setCode(element.getAttribute("ID").getValue());
employee.setName(element.getChild("Name").getText());
Element contractElement = element.getChild("ContractID");
Contract contract = contractMap.get(contractElement.getText());
if (contract == null) {
throw new IllegalArgumentException("The contract (" + contractElement.getText()
+ ") of employee (" + employee.getCode() + ") does not exist.");
employee.setShiftOnRequestMap(new HashMap<>(estimatedRequestSize));
Element skillsElement = element.getChild("Skills");
if (skillsElement != null) {
List<Element> skillElementList = (List<Element>) skillsElement.getChildren();
for (Element skillElement : skillElementList) {
assertElementName(skillElement, "Skill");
Skill skill = skillMap.get(skillElement.getText());
if (skill == null) {
throw new IllegalArgumentException("The skill (" + skillElement.getText()
+ ") of employee (" + employee.getCode() + ") does not exist.");
代码示例来源:origin: org.entando.entando/entando-core-engine
protected String extractValue(Element validationElements, String qName) {
Element element = validationElements.getChild(qName);
if (null != element) {
return element.getText();
}
return null;
}
代码示例来源:origin: kiegroup/optaplanner
shiftType.setCode(element.getAttribute("ID").getValue());
shiftType.setIndex(index);
String startTimeString = element.getChild("StartTime").getText();
shiftType.setStartTimeString(startTimeString);
String endTimeString = element.getChild("EndTime").getText();
shiftType.setEndTimeString(endTimeString);
shiftType.setNight(startTimeString.compareTo(endTimeString) > 0);
shiftType.setDescription(element.getChild("Description").getText());
Element skillsElement = element.getChild("Skills");
shiftTypeSkillRequirement.setId(shiftTypeSkillRequirementId);
shiftTypeSkillRequirement.setShiftType(shiftType);
Skill skill = skillMap.get(skillElement.getText());
if (skill == null) {
throw new IllegalArgumentException("The skill (" + skillElement.getText()
+ ") of shiftType (" + shiftType.getCode() + ") does not exist.");
代码示例来源:origin: apache/oozie
private void setStringCfgSetting(String xmlTag, String configKey) {
Element launcherSetting = xmlLauncherElement.getChild(xmlTag, ns);
if (launcherSetting != null) {
entries.set(configKey, launcherSetting.getText());
}
}
内容来源于网络,如有侵权,请联系作者删除!