OpenImmo/src/main/java/org/openestate/io/openimmo/converters/OpenImmo_1_2_1.java
protected void downgradeEnergiepassElements(Document doc) throws JaxenException {
        List nodes = XmlUtils.newXPath(
                "/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:energiepass",
                doc).selectNodes(doc);
        for (Object item : nodes) {
            Element parentNode = (Element) item;
            boolean skalaProcessed = false;
            String artValue = XmlUtils.newXPath("io:art/text()", doc)
                    .stringValueOf(parentNode);

            List childNodes = XmlUtils.newXPath("io:mitwarmwasser", doc)
                    .selectNodes(parentNode);
            for (Object child : childNodes) {
                Node childNode = (Node) child;
                childNode.getParentNode().removeChild(childNode);
            }

            childNodes = XmlUtils.newXPath("io:energieverbrauchkennwert", doc)
                    .selectNodes(parentNode);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                String childValue = StringUtils.trimToNull(childNode.getTextContent());
                if (!skalaProcessed && "VERBRAUCH".equalsIgnoreCase(artValue) && childValue != null) {
                    skalaProcessed = true;
                    Element skalaNode = doc.createElementNS(OpenImmoUtils.OLD_NAMESPACE, "skala");
                    skalaNode.setAttribute("type", "ZAHL");
                    skalaNode.setTextContent(childValue);
                    parentNode.appendChild(skalaNode);
                }
                childNode.getParentNode().removeChild(childNode);
            }

            childNodes = XmlUtils.newXPath("io:endenergiebedarf", doc)
                    .selectNodes(parentNode);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                String childValue = StringUtils.trimToNull(childNode.getTextContent());
                if (!skalaProcessed && "BEDARF".equalsIgnoreCase(artValue) && childValue != null) {
                    skalaProcessed = true;
                    Element skalaNode = doc.createElementNS(OpenImmoUtils.OLD_NAMESPACE, "skala");
                    skalaNode.setAttribute("type", "ZAHL");
                    skalaNode.setTextContent(childValue);
                    parentNode.appendChild(skalaNode);

                    Element newNode = doc.createElementNS(OpenImmoUtils.OLD_NAMESPACE, "energiebedarf");
                    newNode.setTextContent(childValue);
                    parentNode.appendChild(newNode);
                }
                childNode.getParentNode().removeChild(childNode);
            }
        }
    }
protected void downgradeEnergiepassElements(Document doc) throws JaxenException {
        List nodes = XmlUtils.newXPath(
                "/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:energiepass",
                doc).selectNodes(doc);
        for (Object item : nodes) {
            Element parentNode = (Element) item;
            boolean skalaProcessed = false;
            String artValue = XmlUtils.newXPath("io:art/text()", doc)
                    .stringValueOf(parentNode);

            List childNodes = XmlUtils.newXPath("io:mitwarmwasser", doc)
                    .selectNodes(parentNode);
            for (Object child : childNodes) {
                Node childNode = (Node) child;
                childNode.getParentNode().removeChild(childNode);
            }

            childNodes = XmlUtils.newXPath("io:energieverbrauchkennwert", doc)
                    .selectNodes(parentNode);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                String childValue = StringUtils.trimToNull(childNode.getTextContent());
                if (!skalaProcessed && "VERBRAUCH".equalsIgnoreCase(artValue) && childValue != null) {
                    skalaProcessed = true;
                    Element skalaNode = doc.createElementNS(OpenImmoUtils.OLD_NAMESPACE, "skala");
                    skalaNode.setAttribute("type", "ZAHL");
                    skalaNode.setTextContent(childValue);
                    parentNode.appendChild(skalaNode);
                }
                childNode.getParentNode().removeChild(childNode);
            }

            childNodes = XmlUtils.newXPath("io:endenergiebedarf", doc)
                    .selectNodes(parentNode);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                String childValue = StringUtils.trimToNull(childNode.getTextContent());
                if (!skalaProcessed && "BEDARF".equalsIgnoreCase(artValue) && childValue != null) {
                    skalaProcessed = true;
                    Element skalaNode = doc.createElementNS(OpenImmoUtils.OLD_NAMESPACE, "skala");
                    skalaNode.setAttribute("type", "ZAHL");
                    skalaNode.setTextContent(childValue);
                    parentNode.appendChild(skalaNode);

                    Element newNode = doc.createElementNS(OpenImmoUtils.OLD_NAMESPACE, "energiebedarf");
                    newNode.setTextContent(childValue);
                    parentNode.appendChild(newNode);
                }
                childNode.getParentNode().removeChild(childNode);
            }
        }
    }
Downgrade &lt;energiepass&gt; elements to OpenImmo 1.2.0.
<p>
The &lt;mitwarmwasser&gt; child element of the &lt;energiepass&gt; element
is not available in version 1.2.0.
<p>
The &lt;energieverbrauchkennwert&gt;, &lt;endenergiebedarf&gt; child
elements of the &lt;energiepass&gt; element are moved into
&lt;energiebedarf&gt; and &lt;skala&gt; in version 1.2.0.

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