OpenImmo/src/main/java/org/openestate/io/openimmo/converters/OpenImmo_1_2_5.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 node = (Element) item;
            Element parentNode = (Element) node.getParentNode();
            boolean hwbwertPassed = false;
            boolean hwbklassePassed = false;
            boolean fgeewertPassed = false;
            boolean fgeeklassePassed = false;
            List childNodes;

            // create a <user_defined_simplefield> for <hwbwert> elements
            childNodes = XmlUtils.newXPath("io:hwbwert", doc)
                    .selectNodes(node);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                if (!hwbwertPassed) {
                    String value = StringUtils.trimToNull(childNode.getTextContent());
                    if (value != null) {
                        parentNode.appendChild(OpenImmoUtils.createUserDefinedSimplefield(doc, "epass_hwbwert", value));
                        hwbwertPassed = true;
                    }
                }
                node.removeChild(childNode);
            }

            // create a <user_defined_simplefield> for <hwbklasse> elements
            childNodes = XmlUtils.newXPath("io:hwbklasse", doc)
                    .selectNodes(node);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                if (!hwbklassePassed) {
                    String value = StringUtils.trimToNull(childNode.getTextContent());
                    if (value != null) {
                        parentNode.appendChild(OpenImmoUtils.createUserDefinedSimplefield(doc, "epass_hwbklasse", value));
                        hwbklassePassed = true;
                    }
                }
                node.removeChild(childNode);
            }

            // create a <user_defined_simplefield> for <fgeewert> elements
            childNodes = XmlUtils.newXPath("io:fgeewert", doc)
                    .selectNodes(node);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                if (!fgeewertPassed) {
                    String value = StringUtils.trimToNull(childNode.getTextContent());
                    if (value != null) {
                        parentNode.appendChild(OpenImmoUtils.createUserDefinedSimplefield(doc, "epass_fgeewert", value));
                        fgeewertPassed = true;
                    }
                }
                node.removeChild(childNode);
            }

            // create a <user_defined_simplefield> for <baujahr> elements
            childNodes = XmlUtils.newXPath("io:fgeeklasse", doc)
                    .selectNodes(node);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                if (!fgeeklassePassed) {
                    String value = StringUtils.trimToNull(childNode.getTextContent());
                    if (value != null) {
                        parentNode.appendChild(OpenImmoUtils.createUserDefinedSimplefield(doc, "epass_fgeeklasse", value));
                        fgeeklassePassed = true;
                    }
                }
                node.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 node = (Element) item;
            Element parentNode = (Element) node.getParentNode();
            boolean hwbwertPassed = false;
            boolean hwbklassePassed = false;
            boolean fgeewertPassed = false;
            boolean fgeeklassePassed = false;
            List childNodes;

            // create a <user_defined_simplefield> for <hwbwert> elements
            childNodes = XmlUtils.newXPath("io:hwbwert", doc)
                    .selectNodes(node);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                if (!hwbwertPassed) {
                    String value = StringUtils.trimToNull(childNode.getTextContent());
                    if (value != null) {
                        parentNode.appendChild(OpenImmoUtils.createUserDefinedSimplefield(doc, "epass_hwbwert", value));
                        hwbwertPassed = true;
                    }
                }
                node.removeChild(childNode);
            }

            // create a <user_defined_simplefield> for <hwbklasse> elements
            childNodes = XmlUtils.newXPath("io:hwbklasse", doc)
                    .selectNodes(node);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                if (!hwbklassePassed) {
                    String value = StringUtils.trimToNull(childNode.getTextContent());
                    if (value != null) {
                        parentNode.appendChild(OpenImmoUtils.createUserDefinedSimplefield(doc, "epass_hwbklasse", value));
                        hwbklassePassed = true;
                    }
                }
                node.removeChild(childNode);
            }

            // create a <user_defined_simplefield> for <fgeewert> elements
            childNodes = XmlUtils.newXPath("io:fgeewert", doc)
                    .selectNodes(node);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                if (!fgeewertPassed) {
                    String value = StringUtils.trimToNull(childNode.getTextContent());
                    if (value != null) {
                        parentNode.appendChild(OpenImmoUtils.createUserDefinedSimplefield(doc, "epass_fgeewert", value));
                        fgeewertPassed = true;
                    }
                }
                node.removeChild(childNode);
            }

            // create a <user_defined_simplefield> for <baujahr> elements
            childNodes = XmlUtils.newXPath("io:fgeeklasse", doc)
                    .selectNodes(node);
            for (Object childItem : childNodes) {
                Node childNode = (Node) childItem;
                if (!fgeeklassePassed) {
                    String value = StringUtils.trimToNull(childNode.getTextContent());
                    if (value != null) {
                        parentNode.appendChild(OpenImmoUtils.createUserDefinedSimplefield(doc, "epass_fgeeklasse", value));
                        fgeeklassePassed = true;
                    }
                }
                node.removeChild(childNode);
            }
        }
    }
Downgrade &lt;energiepass&gt; elements to OpenImmo 1.2.4.
<p>
The child elements &lt;hwbwert&gt;, &lt;hwbklasse&gt;,
&lt;fgeewert&gt;, &lt;fgeeklasse&gt; are copied into separate
&lt;user_defined_simplefield&gt; elements as it was
suggested by OpenImmo e.V..

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