org.jdom.Attribute.getValue()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(151)

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

Attribute.getValue介绍

[英]This will return the actual textual value of this Attribute. This will include all text within the quotation marks.
[中]这将返回此Attribute的实际文本值。这将包括引号内的所有文本。

代码示例

代码示例来源:origin: jaxen/jaxen

public String getAttributeStringValue(Object obj)
{
  Attribute attr = (Attribute) obj;
  return attr.getValue();
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

public String getAttribute(int index) {
  return ((Attribute) currentElement.getAttributes().get(index)).getValue();
}

代码示例来源:origin: org.freemarker/freemarker

public void output(Attribute attribute, Writer out)
  throws IOException {
    out.write(" ");
    out.write(attribute.getQualifiedName());
    out.write("=");
    out.write("\"");
    out.write(escapeAttributeEntities(attribute.getValue()));
    out.write("\"");
  }
}

代码示例来源: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

public List operate(Object node) {
      if (node instanceof Element)
        return Collections.singletonList(((Element) node).getTextTrim());
      if (node instanceof Attribute)
        return Collections.singletonList(((Attribute) node).getValue());
      if (node instanceof CDATA)
        return Collections.singletonList(((CDATA) node).getText());
      if (node instanceof Comment)
        return Collections.singletonList(((Comment) node).getText());
      if (node instanceof ProcessingInstruction)
        return Collections.singletonList(((ProcessingInstruction) node).getData());
      // With 2.1 semantics it  makes more sense to just return a null and let the core 
      // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
      return null;
//            throw new TemplateModelException("_text can not be applied on " + node.getClass());
    }
  }

代码示例来源:origin: org.freemarker/freemarker

@Override
String getText(Object node) {
  if (node instanceof Element) {
    return ((Element) node).getTextTrim();
  }
  if (node instanceof Attribute) {
    return ((Attribute) node).getValue();
  }
  if (node instanceof CDATA) {
    return ((CDATA) node).getText();
  }
  if (node instanceof Comment) {
    return ((Comment) node).getText();
  }
  if (node instanceof ProcessingInstruction) {
    return ((ProcessingInstruction) node).getData();
  }
  return null;
}

代码示例来源:origin: org.freemarker/freemarker

sw.write(attribute.getQualifiedName());
  sw.write("=\"");
  sw.write(OUTPUT.escapeAttributeEntities(attribute.getValue()));
  sw.write("\"");
} else if (node instanceof Text) {

代码示例来源:origin: kiegroup/optaplanner

NurseRoster nurseRoster = new NurseRoster();
nurseRoster.setId(0L);
nurseRoster.setCode(schedulingPeriodElement.getAttribute("ID").getValue());

代码示例来源: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

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: velocity/velocity-dep

public void output(Attribute attribute, Writer out)
    throws IOException
  {
    out.write(" ");
    out.write(attribute.getQualifiedName());
    out.write("=");
    
    out.write("\"");
    out.write(escapeAttributeEntities(attribute.getValue()));
    out.write("\"");            
  }
}

代码示例来源:origin: org.freemarker/com.springsource.freemarker

public void output(Attribute attribute, Writer out)
  throws
  IOException
  {
    out.write(" ");
    out.write(attribute.getQualifiedName());
    out.write("=");
    out.write("\"");
    out.write(escapeAttributeEntities(attribute.getValue()));
    out.write("\"");
  }
}

代码示例来源:origin: de.smartics.testdoc/testdoc-report

private static JUnitTestMethodDoc createTestCase(final Element testCaseElement)
{
 final String time = testCaseElement.getAttribute("time").getValue();
 final String testCaseType =
   testCaseElement.getAttribute("classname").getValue();
 final String testMethodName =
   testCaseElement.getAttribute("name").getValue();
 final ResultType resultType = getResultType(testCaseElement);
 final JUnitTestMethodDoc testCaseDoc =
   new JUnitTestMethodDoc(resultType, time, testCaseType, testMethodName);
 return testCaseDoc;
}

代码示例来源:origin: qcadoo/mes

private void parseAndAddFaultType(final Element node) {
  @SuppressWarnings("unchecked")
  List<Attribute> attributes = node.getAttributes();
  Map<String, String> values = Maps.newHashMap();
  for (Attribute attribute : attributes) {
    values.put(attribute.getName().toLowerCase(Locale.ENGLISH), attribute.getValue());
  }
  addFaultType(values);
}

代码示例来源:origin: CeON/CERMINE

private void convertPages(Element source, DocumentMetadata metadata) throws JDOMException {
  XPath xpath = XPath.newInstance("./x:element/x:structure/x:current[@level='bwmeta1.level.hierarchy_Journal_Article']/@position");
  xpath.addNamespace("x", source.getNamespaceURI());
  Attribute pages = (Attribute)xpath.selectSingleNode(source);
  if (pages != null) {
    String fp = pages.getValue().replaceFirst("-.*", "");
    String lp = pages.getValue().replaceFirst(".*-", "");
    metadata.setPages(fp, lp);
  }
}

代码示例来源:origin: CeON/CERMINE

private void convertYear(Element source, DocumentMetadata metadata) throws JDOMException {
  XPath xpath = XPath.newInstance(".//x:date[@type='published']/@when");
  xpath.addNamespace("x", source.getNamespaceURI());
  Attribute pubYear = (Attribute)xpath.selectSingleNode(source);
  if (pubYear != null) {
    metadata.setDate(DateType.PUBLISHED, null, null, pubYear.getValue());
  }
}

代码示例来源:origin: CeON/CERMINE

private void convertDoi(Element source, DocumentMetadata metadata) throws JDOMException {
  XPath xpath = XPath.newInstance("./x:element/x:id[@scheme='bwmeta1.id-class.DOI']/@value");
  xpath.addNamespace("x", source.getNamespaceURI());
  Attribute doi = (Attribute)xpath.selectSingleNode(source);
  if (doi != null) {
    metadata.addId(IDType.DOI, doi.getValue());
  }
}

相关文章