public void copyBasicInfo(final XmlNode xmlNode) { if (xmlNode == null) { return; } final String name = xmlNode.getName(); final String value = xmlNode.getValue(); BasicInfo basicInfo = null; if (ERROR.equals(name)) { basicInfo = addError(); } else if (WARNING.equals(name)) { basicInfo = addWarning(); } else if (INFO.equals(name)) { basicInfo = addInfo(); } basicInfo.setValue(value); final Map<String, String> attributes = xmlNode.getAttributes(); for (final Entry<String, String> entry : attributes.entrySet()) { basicInfo.setAttribute(entry.getKey(), entry.getValue()); } }
/** * The children of the given {@code XmlNode} are added to the list of information. * * @param infoContainerXmlNode the {@code XmlNode} to integrate. */ public void addInfo(final XmlNode infoContainerXmlNode) { List<XmlNode> children; if (infoContainerXmlNode == null || (children = infoContainerXmlNode.getChildren()).isEmpty()) { return; } ensureInfoList(); for (final XmlNode child : children) { final String value = child.getValue(); final String messageId = DSSUtils.getMessageId(value); final Info info = new Info(messageId, value); final Map<String, String> attributes = child.getAttributes(); for (final Entry<String, String> entry : attributes.entrySet()) { final String attributeName = entry.getKey(); final String attributeValue = entry.getValue(); info.setAttribute(attributeName, attributeValue); } infoList.add(info); } }