public Object getProperty(String name, Document doc) { String rawdoc = doc.getContent(); String[] titles = org.apache.commons.lang3.StringUtils.substringsBetween( rawdoc, "<" + name + ">", "</" + name + ">"); return titles[0]; }
public Map<String, Object> getAllProperties(Document doc) { Map<String, Object> allProperties = new HashMap<String, Object>(); String rawdoc = doc.getContent(); List<String> properties = getPropertiesNames(); for (String propertyName : properties) { String propertyValue = org.apache.commons.lang3.StringUtils.substringsBetween( rawdoc, "<" + propertyName + ">", "</" + propertyName + ">")[0]; propertyValue = org.apache.commons.lang3.StringEscapeUtils.escapeXml(propertyValue); allProperties.put(propertyName, propertyValue); } return allProperties; }