org.jdom.Element.getChildTextTrim()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(203)

本文整理了Java中org.jdom.Element.getChildTextTrim()方法的一些代码示例,展示了Element.getChildTextTrim()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getChildTextTrim()方法的具体详情如下:
包路径:org.jdom.Element
类名称:Element
方法名:getChildTextTrim

Element.getChildTextTrim介绍

[英]Returns the trimmed textual content of the named child element, or null if there's no such child. See #getTextTrim() for details of text trimming.
[中]返回命名子元素的修剪文本内容,如果没有这样的子元素,则返回null。有关文本修剪的详细信息,请参见#getTextTrim()

代码示例

代码示例来源:origin: locationtech/geowave

public static String getStringVal(final Element e, final String childText, final Namespace ns) {
 if (e == null) {
  return null;
 } else {
  return e.getChildTextTrim(childText, ns);
 }
}

代码示例来源:origin: bcdev/beam

private static String getExpression(Element element) {
  if (element != null) {
    return element.getChildTextTrim(DimapProductConstants.TAG_VIRTUAL_BAND_EXPRESSION);
  }
  return null;
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

public String getChildTextTrim(String name, Namespace ns)
{
  return element.getChildTextTrim(name, ns);
}

代码示例来源:origin: net.sf.taverna.t2.component/component-activity

public MyExperimentLicense(MyExperimentComponentRegistry componentRegistry,
    String uri) {
  Element licenseElement = componentRegistry.getResource(uri);
  name = licenseElement.getChildTextTrim("title");
  description = licenseElement.getChildTextTrim("description");
  abbreviation = licenseElement.getChildTextTrim("unique-name");
}

代码示例来源:origin: net.sf.taverna.t2.component/component-registry

public MyExperimentLicense(MyExperimentComponentRegistry componentRegistry,
    String uri) {
  Element licenseElement = componentRegistry.getResource(uri);
  name = licenseElement.getChildTextTrim("title");
  description = licenseElement.getChildTextTrim("description");
  abbreviation = licenseElement.getChildTextTrim("unique-name");
}

代码示例来源:origin: bcdev/beam

private static boolean is(Element element, final String tagName) {
  if (element == null) {
    return false;
  }
  final String childTextTrim = element.getChildTextTrim(tagName);
  return Boolean.parseBoolean(childTextTrim);
}

代码示例来源:origin: bcdev/beam

private void addSamples(String tagNameSampleElements, String tagNameSampleName, String tagNameSampleValue,
            String tagNameSampleDescription,
            Element sampleCodingElement, SampleCoding sampleCoding) {
  final List list = sampleCodingElement.getChildren(tagNameSampleElements);
  for (Object o : list) {
    final Element element = (Element) o;
    final String name = element.getChildTextTrim(tagNameSampleName);
    final int value = Integer.parseInt(element.getChildTextTrim(tagNameSampleValue));
    final String description = element.getChildTextTrim(tagNameSampleDescription);
    sampleCoding.addSample(name, value, description);
  }
}

代码示例来源:origin: org.openwfe/openwfe-applic

public static RsaKey buildKey (org.jdom.Element elt)
{
  if (elt == null) return null;
  String eName = elt.getName();
  String keyType = PRIVATE;
  if (eName.equals(PUBLIC_KEY)) keyType = PUBLIC;
  String exp = elt.getChildTextTrim(EXP);
  String mod = elt.getChildTextTrim(MOD);
  return new RsaKey(keyType, exp, mod);
}

代码示例来源:origin: locationtech/geowave

public static String getStringVal(final Element e, final String childText, final boolean trim) {
 if (e == null) {
  return null;
 } else {
  if (trim) {
   return e.getChildTextTrim(childText);
  } else {
   return e.getChildText(childText);
  }
 }
}

代码示例来源:origin: bcdev/beam

private static void setSolarFlux(final Element element, final Band band) {
  final String solarFlux = element.getChildTextTrim(DimapProductConstants.TAG_SOLAR_FLUX);
  if (solarFlux != null) {
    band.setSolarFlux(Float.parseFloat(solarFlux));
  }
}

代码示例来源:origin: apache/maven-release

@Override
public String getArtifactId()
{
  return element.getChildTextTrim( "artifactId", element.getNamespace() );
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

private void storeElementTextInAttribute(org.jdom.Element element, String elementName,
    YRelation relation, String attributeName) {
  String text = element.getChildTextTrim(elementName);
  if (text != null && !text.isEmpty()) {
    relation.addAttribute(attributeName, text);
  }
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

static String getChildTextTrim(org.jdom.Element e, String name) {
  if (e == null) {
    return null;
  }
  Namespace ns = e.getNamespace();
  return e.getChildTextTrim(name, ns);
}

代码示例来源:origin: bcdev/beam

private static void setSpectralBandWidth(final Element element, final Band band) {
  final String bandWidth = element.getChildTextTrim(DimapProductConstants.TAG_BANDWIDTH);
  if (bandWidth != null) {
    band.setSpectralBandwidth(Float.parseFloat(bandWidth));
  }
}

代码示例来源:origin: bcdev/beam

private static void setUnit(final Element element, final Band band) {
  final String unit = element.getChildTextTrim(DimapProductConstants.TAG_PHYSICAL_UNIT);
  if (unit != null) {
    band.setUnit(unit);
  }
}

代码示例来源:origin: bcdev/beam

private ProductData.UTC getSceneRasterStartTime() {
  final Element child = getRootElement().getChild(DimapProductConstants.TAG_PRODUCTION);
  String timeString = child.getChildTextTrim(DimapProductConstants.TAG_PRODUCT_SCENE_RASTER_START_TIME);
  if (StringUtils.isNullOrEmpty(timeString)) {
    timeString = child.getChildTextTrim(DimapProductConstants.TAG_OLD_SCENE_RASTER_START_TIME);
  }
  return parseTimeString(timeString);
}

代码示例来源:origin: net.sf.taverna.t2.component/component-activity

public License getLicenseOnObject(String uri) throws RegistryException {
  String licenseString = getResource(uri)
      .getChildTextTrim("license-type");
  return getLicenseByAbbreviation(licenseString);
}

代码示例来源:origin: net.sf.taverna.t2.component/component-registry

public License getLicenseOnObject(String uri) throws RegistryException {
  String licenseString = getResource(uri)
      .getChildTextTrim("license-type");
  return getLicenseByAbbreviation(licenseString);
}

代码示例来源:origin: bcdev/beam

private static int[] getHistogramBins(Element bandStatisticsElem) {
  final String histogramValues = bandStatisticsElem.getChildTextTrim(DimapProductConstants.TAG_HISTOGRAM);
  if (StringUtils.isNullOrEmpty(histogramValues)) {
    return null;
  }
  return StringUtils.toIntArray(histogramValues, null);
}

代码示例来源:origin: bcdev/beam

private static void setAutoGrouping(final Element element, Product product) {
  final String text = element.getChildTextTrim(DimapProductConstants.TAG_DATASET_AUTO_GROUPING);
  if (StringUtils.isNotNullAndNotEmpty(text)) {
    product.setAutoGrouping(text);
  } else {
    product.setAutoGrouping("");
  }
}

相关文章

微信公众号

最新文章

更多