OpenImmo/src/main/java/org/openestate/io/openimmo/converters/OpenImmo_1_2_3.java
protected void downgradeFlaechenChildElements(Document doc) throws JaxenException {
        List nodes = XmlUtils.newXPath(
                "/io:openimmo/io:anbieter/io:immobilie/io:flaechen",
                doc).selectNodes(doc);
        for (Object item : nodes) {
            Element parentNode = (Element) item;
            boolean passedAnzahlBalkone = false;
            boolean passedAnzahlTerrassen = false;
            double sum = 0;

            List childNodes = XmlUtils.newXPath("io:anzahl_balkone", doc)
                    .selectNodes(parentNode);
            for (Object childItem : childNodes) {
                Node node = (Node) childItem;
                if (!passedAnzahlBalkone) {
                    passedAnzahlBalkone = true;
                    String value = StringUtils.trimToNull(node.getTextContent());
                    try {
                        sum += (value != null) ? Double.parseDouble(value) : 0;
                    } catch (NumberFormatException ex) {
                        LOGGER.warn("Can't parse <anzahl_balkone>" + value + "</anzahl_balkone> into a numeric value!");
                        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
                    }
                }
                parentNode.removeChild(node);
            }

            childNodes = XmlUtils.newXPath("io:anzahl_terrassen", doc)
                    .selectNodes(parentNode);
            for (Object childItem : childNodes) {
                Node node = (Node) childItem;
                if (!passedAnzahlTerrassen) {
                    passedAnzahlTerrassen = true;
                    String value = StringUtils.trimToNull(node.getTextContent());
                    try {
                        sum += (value != null) ? Double.parseDouble(value) : 0;
                    } catch (NumberFormatException ex) {
                        LOGGER.warn("Can't parse <anzahl_terrassen>" + value + "</anzahl_terrassen> into a numeric value!");
                        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
                    }
                }
                parentNode.removeChild(node);
            }

            if (sum > 0) {
                Element node = (Element) XmlUtils.newXPath("io:anzahl_balkon_terrassen", doc)
                        .selectSingleNode(parentNode);
                if (node == null) {
                    node = doc.createElementNS(StringUtils.EMPTY, "anzahl_balkon_terrassen");
                    node.setTextContent(String.valueOf(sum));
                    parentNode.appendChild(node);
                } else if (StringUtils.isBlank(node.getTextContent())) {
                    node.setTextContent(String.valueOf(sum));
                }
            }
        }
    }
protected void downgradeFlaechenChildElements(Document doc) throws JaxenException {
        List nodes = XmlUtils.newXPath(
                "/io:openimmo/io:anbieter/io:immobilie/io:flaechen",
                doc).selectNodes(doc);
        for (Object item : nodes) {
            Element parentNode = (Element) item;
            boolean passedAnzahlBalkone = false;
            boolean passedAnzahlTerrassen = false;
            double sum = 0;

            List childNodes = XmlUtils.newXPath("io:anzahl_balkone", doc)
                    .selectNodes(parentNode);
            for (Object childItem : childNodes) {
                Node node = (Node) childItem;
                if (!passedAnzahlBalkone) {
                    passedAnzahlBalkone = true;
                    String value = StringUtils.trimToNull(node.getTextContent());
                    try {
                        sum += (value != null) ? Double.parseDouble(value) : 0;
                    } catch (NumberFormatException ex) {
                        LOGGER.warn("Can't parse <anzahl_balkone>" + value + "</anzahl_balkone> into a numeric value!");
                        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
                    }
                }
                parentNode.removeChild(node);
            }

            childNodes = XmlUtils.newXPath("io:anzahl_terrassen", doc)
                    .selectNodes(parentNode);
            for (Object childItem : childNodes) {
                Node node = (Node) childItem;
                if (!passedAnzahlTerrassen) {
                    passedAnzahlTerrassen = true;
                    String value = StringUtils.trimToNull(node.getTextContent());
                    try {
                        sum += (value != null) ? Double.parseDouble(value) : 0;
                    } catch (NumberFormatException ex) {
                        LOGGER.warn("Can't parse <anzahl_terrassen>" + value + "</anzahl_terrassen> into a numeric value!");
                        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
                    }
                }
                parentNode.removeChild(node);
            }

            if (sum > 0) {
                Element node = (Element) XmlUtils.newXPath("io:anzahl_balkon_terrassen", doc)
                        .selectSingleNode(parentNode);
                if (node == null) {
                    node = doc.createElementNS(StringUtils.EMPTY, "anzahl_balkon_terrassen");
                    node.setTextContent(String.valueOf(sum));
                    parentNode.appendChild(node);
                } else if (StringUtils.isBlank(node.getTextContent())) {
                    node.setTextContent(String.valueOf(sum));
                }
            }
        }
    }
Remove unsupported children from all &lt;flaechen&gt; elements.
<p>
OpenImmo 1.2.2 does not support the following children for
&lt;flaechen&gt; elements: &lt;anzahl_balkone&gt;, &lt;anzahl_terrassen&gt;
<p>
These elements are removed by this function. If
&lt;anzahl_balkon_terrassen&gt; is not already specified, the sum values of
&lt;anzahl_balkone&gt; and &lt;anzahl_terrassen&gt; are written into
&lt;anzahl_balkon_terrassen&gt;.

@param doc OpenImmo document in version 1.2.3
@throws JaxenException if xpath evaluation failed