public static ChangelogEntry readFromXmlFile()

in log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/ChangelogEntry.java [113:142]


    public static ChangelogEntry readFromXmlFile(final Path path) {

        // Read the `entry` root element
        final Element entryElement = XmlReader.readXmlFileRootElement(path, "entry");
        final String typeAttribute = XmlReader.requireAttribute(entryElement, "type");
        final Type type;
        try {
            type = Type.fromXmlAttribute(typeAttribute);
        } catch (final Exception error) {
            throw XmlReader.failureAtXmlNode(error, entryElement, "`type` attribute read failure");
        }

        // Read the `issue` elements
        final List<Issue> issues = XmlReader.findChildElementsMatchingName(entryElement, "issue")
                .map(issueElement -> {
                    final String issueId = XmlReader.requireAttribute(issueElement, "id");
                    final String issueLink = XmlReader.requireAttribute(issueElement, "link");
                    return new Issue(issueId, issueLink);
                })
                .collect(Collectors.toList());

        // Read the `description` element
        final Element descriptionElement = XmlReader.requireChildElementMatchingName(entryElement, "description");
        final String descriptionFormat = XmlReader.requireAttribute(descriptionElement, "format");
        final String descriptionText = StringUtils.trimNullable(descriptionElement.getTextContent());
        final Description description = new Description(descriptionFormat, descriptionText);

        // Create the instance
        return new ChangelogEntry(type, issues, description);
    }