public String getAttributeStringValue(Object obj) { Attribute attr = (Attribute) obj; return attr.getValue(); }
public String getAttribute(int index) { return ((Attribute) currentElement.getAttributes().get(index)).getValue(); }
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("\""); } }
@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); }
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()); } }
@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; }
sw.write(attribute.getQualifiedName()); sw.write("=\""); sw.write(OUTPUT.escapeAttributeEntities(attribute.getValue())); sw.write("\""); } else if (node instanceof Text) {
NurseRoster nurseRoster = new NurseRoster(); nurseRoster.setId(0L); nurseRoster.setCode(schedulingPeriodElement.getAttribute("ID").getValue());
Employee employee = new Employee(); employee.setId(id); employee.setCode(element.getAttribute("ID").getValue()); employee.setName(element.getChild("Name").getText()); Element contractElement = element.getChild("ContractID");
ShiftType shiftType = new ShiftType(); shiftType.setId(id); shiftType.setCode(element.getAttribute("ID").getValue()); shiftType.setIndex(index); String startTimeString = element.getChild("StartTime").getText();
Contract contract = new Contract(); contract.setId(id); contract.setCode(element.getAttribute("ID").getValue()); contract.setDescription(element.getChild("Description").getText());
for (Element element : patternElementList) { assertElementName(element, "Pattern"); String code = element.getAttribute("ID").getValue(); int weight = element.getAttribute("weight").getIntValue();
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);
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("\""); } }
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("\""); } }
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; }
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); }
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); } }
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()); } }
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()); } }