/** * Converts the list of {@code XmlDom} to {@code List} of {@code String}. The children of the node are not taken * into account. * * @param xmlDomList the list of {@code XmlDom} to convert * @return converted {@code List} of {@code String}. */ public static List<String> convertToStringList(final List<XmlDom> xmlDomList) { final List<String> stringList = new ArrayList<String>(); for (final XmlDom xmlDom : xmlDomList) { stringList.add(xmlDom.getText()); } return stringList; }
/** * This method checks if all indications contained within the {@code indications} are VALID. * * @param indications {@code List} of {@code XmlDom} containing the INDICATION * @return {@code true} if all contained indications are equal to VALID, otherwise {@code false} */ private boolean areAllIndicationsValid(final List<XmlDom> indications) { boolean valid = indications.size() > 0; for (final XmlDom indicationDom : indications) { final String indication = indicationDom.getText(); valid = valid && Indication.VALID.equals(indication); } return valid; } }
public List<String> getCertificateTSPServiceQualifiers(final int dssCertificateId) { List<String> tspServiceQualifiers = new ArrayList<String>(); final List<XmlDom> TSPServiceQualifiers = getElements("/DiagnosticData/UsedCertificates/Certificate[@Id='%s']/TrustedServiceProvider/Qualifiers/Qualifier", dssCertificateId); for (XmlDom tspServiceQualifier : TSPServiceQualifiers) { tspServiceQualifiers.add(tspServiceQualifier.getText()); } return tspServiceQualifiers; }
/** * Converts the list of {@code XmlDom} to {@code Map} of {@code String}, {@code String}. The children of the node are not taken * into account. * * @param xmlDomList the list of {@code XmlDom} to convert * @param attributeName the name of the attribute to use as value * @return converted {@code Map} of {@code String}, {@code String} corresponding to the element content and the attribute value. */ public static Map<String, String> convertToStringMap(final List<XmlDom> xmlDomList, final String attributeName) { final Map<String, String> stringMap = new HashMap<String, String>(); for (final XmlDom xmlDom : xmlDomList) { final String key = xmlDom.getText(); final String value = xmlDom.getAttribute(attributeName); stringMap.put(key, value); } return stringMap; }
private List<Conclusion.BasicInfo> getBasicInfo(final String signatureId, final String basicInfoType) { final List<XmlDom> elementList = getElements("/SimpleReport/Signature[@Id='%s']/" + basicInfoType, signatureId); final List<Conclusion.BasicInfo> infoList = new ArrayList<Conclusion.BasicInfo>(); for (final XmlDom infoElement : elementList) { Conclusion.BasicInfo basicInfo = new Conclusion.BasicInfo(basicInfoType); basicInfo.setValue(infoElement.getText()); final NamedNodeMap attributes = infoElement.getAttributes(); for (int index = 0; index < attributes.getLength(); index++) { final Node attribute = attributes.item(index); basicInfo.setAttribute(attribute.getNodeName(), attribute.getNodeValue()); } infoList.add(basicInfo); } return infoList; }
/** * This method adds the content of nodes contained in the given {@code List} of {@code XmlDom}(s) as information. * * @param infoList the {@code List} of {@code XmlDom}(s) to be integrated. */ public void addInfo(final List<XmlDom> infoList) { if (infoList == null || infoList.isEmpty()) { return; } ensureInfoList(); for (final XmlDom xmlDom : infoList) { final String value = xmlDom.getText(); final Info info = new Info(value); copyAttributes(xmlDom, info); this.infoList.add(info); } }
/** * This method adds the content of nodes contained in the given {@code List} of {@code XmlDom}(s) as error. * * @param errors the {@code List} of {@code XmlDom}(s) to be integrated. */ private void addErrors(final List<XmlDom> errors) { if (errors == null || errors.isEmpty()) { return; } ensureErrorList(); for (final XmlDom errorXmlDom : errors) { final String value = errorXmlDom.getText(); final Error error = new Error(value); copyAttributes(errorXmlDom, error); errorList.add(error); } }
/** * This method adds the content of nodes contained in the given {@code List} of {@code XmlDom}(s) as warning. * * @param warnings the {@code List} of {@code XmlDom}(s) to be integrated. */ private void addWarnings(List<XmlDom> warnings) { if (warnings == null || warnings.isEmpty()) { return; } ensureWarningList(); for (final XmlDom warningXmlDom : warnings) { final String value = warningXmlDom.getText(); final Warning warning = new Warning(value); copyAttributes(warningXmlDom, warning); warningList.add(warning); } }
for (final XmlDom xmlDom : xmlDomList) { final String key = xmlDom.getText(); final String dateString = xmlDom.getAttribute(attributeName); String format = xmlDom.getAttribute("Format");
signatureProductionPlace += element.getName() + ": " + element.getText();
for (XmlDom errorDom : errorMessages) { String errorMessage = errorDom.getText(); errorMessage = StringEscapeUtils.escapeXml(errorMessage); final XmlNode xmlNode = new XmlNode(NodeName.INFO, errorMessage);