List of usage examples for org.w3c.dom Element removeChild
public Node removeChild(Node oldChild) throws DOMException;
oldChild
from the list of children, and returns it. From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java
/** * Replace <parken> elements with <sonstige> elements. * <p>//from ww w. jav a2 s .c o m * OpenImmo 1.2.2 does not support <parken> elements. Any occurence is * converted into <sonstige> elements. * * @param doc OpenImmo document in version 1.2.3 * @throws JaxenException */ protected void downgradeParkenElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:parken", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parentNode = (Element) node.getParentNode(); parentNode.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "sonstige"); newNode.setAttribute("sonstige_typ", "PARKFLACHE"); parentNode.appendChild(newNode); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java
/** * Downgrade <sonstige> elements to OpenImmo 1.2.2. * <p>/*from w w w . ja v a 2 s .c o m*/ * The option "KRANKENHAUS" for the "sonstige_typ" * attribute of <sonstige> elements is placed in the <haus> * element in version 1.2.2. * * @param doc OpenImmo document in version 1.2.3 * @throws JaxenException */ protected void downgradeSonstigeElements(Document doc) throws JaxenException { List nodes = XmlUtils.newXPath( "/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:sonstige[@sonstige_typ]", doc).selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parent = (Element) node.getParentNode(); String value = StringUtils.trimToNull(node.getAttribute("sonstige_typ")); if ("KRANKENHAUS".equalsIgnoreCase(value)) { parent.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "haus"); newNode.setAttribute("haustyp", "KRANKENHAUS"); parent.appendChild(newNode); } } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java
/** * Downgrade <zinshaus_renditeobjekt> elements to OpenImmo 1.2.2. * <p>/*from ww w . j a va 2s . co m*/ * The options "PFLEGEHEIM", "SANATORIUM", "SENIORENHEIM", "BETREUTES-WOHNEN" * for the "zins_typ" attribute of <zinshaus_renditeobjekt> elements are * placed in the <haus> element in version 1.2.2. * * @param doc OpenImmo document in version 1.2.3 * @throws JaxenException */ protected void downgradeZinshausRenditeobjektElements(Document doc) throws JaxenException { List nodes = XmlUtils.newXPath( "/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:zinshaus_renditeobjekt[@zins_typ]", doc).selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parent = (Element) node.getParentNode(); String value = StringUtils.trimToNull(node.getAttribute("zins_typ")); if ("PFLEGEHEIM".equalsIgnoreCase(value)) { parent.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "haus"); newNode.setAttribute("haustyp", "PFLEGEHEIM"); parent.appendChild(newNode); } else if ("SANATORIUM".equalsIgnoreCase(value)) { parent.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "haus"); newNode.setAttribute("haustyp", "SANATORIUM"); parent.appendChild(newNode); } else if ("SENIORENHEIM".equalsIgnoreCase(value)) { parent.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "haus"); newNode.setAttribute("haustyp", "SENIORENHEIM"); parent.appendChild(newNode); } else if ("BETREUTES-WOHNEN".equalsIgnoreCase(value)) { parent.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "haus"); newNode.setAttribute("haustyp", "BETREUTES-WOHNEN"); parent.appendChild(newNode); } } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java
/** * Remove unsupported children from all <ausstattung> elements. * <p>/*from ww w. ja v a 2 s . c o m*/ * OpenImmo 1.2.2 does not support the following children for * <ausstattung> elements: <energietyp>, <bibliothek>, * <dachboden>, <gaestewc>, <kabelkanaele>, * <seniorengerecht> * <p> * These elements are removed by this function. * * @param doc OpenImmo document in version 1.2.3 * @throws JaxenException */ protected void removeAusstattungChildElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:energietyp | " + "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:bibliothek | " + "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:dachboden | " + "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:gaestewc | " + "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:kabelkanaele | " + "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:seniorengerecht", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parentNode = (Element) node.getParentNode(); parentNode.removeChild(node); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java
/** * Remove <email_feedback> elements. * <p>/*from w w w . j a v a2s. co m*/ * OpenImmo 1.2.2 does not support <email_feedback> elements. * * @param doc OpenImmo document in version 1.2.3 * @throws JaxenException */ protected void removeEmailFeedbackElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:kontaktperson/io:email_feedback", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parentNode = (Element) node.getParentNode(); parentNode.removeChild(node); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java
/** * Remove unsupported children from all <preise> elements. * <p>/*w ww . j a v a 2 s .c o m*/ * OpenImmo 1.2.2 does not support the following children for * <preise> elements: <courtage_hinweis>, * <nettorendite_soll>, <nettorendite_ist> * <p> * These elements are removed by this function. * * @param doc OpenImmo document in version 1.2.3 * @throws JaxenException */ protected void removePreiseChildElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:preise/io:courtage_hinweis | " + "/io:openimmo/io:anbieter/io:immobilie/io:preise/io:nettorendite_soll | " + "/io:openimmo/io:anbieter/io:immobilie/io:preise/io:nettorendite_ist", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parentNode = (Element) node.getParentNode(); parentNode.removeChild(node); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java
/** * Remove <user_defined_extend> elements. * <p>//from w ww. j a v a 2 s. c o m * OpenImmo 1.2.2 does not support <user_defined_extend> elements in * <freitexte> and <anhaenge> elements. * * @param doc OpenImmo document in version 1.2.3 * @throws JaxenException */ protected void removeUserDefinedExtendElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:freitexte/io:user_defined_extend | " + "/io:openimmo/io:anbieter/io:immobilie/io:anhaenge/io:user_defined_extend", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parentNode = (Element) node.getParentNode(); parentNode.removeChild(node); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java
/** * Remove unsupported children from all <zustand_angaben> elements. * <p>/*from w w w. ja v a 2s . c o m*/ * OpenImmo 1.2.2 does not support the following children for * <zustand_angaben> elements: <letztemodernisierung>, * <verkaufstatus> * <p> * These elements are removed by this function. * * @param doc OpenImmo document in version 1.2.3 * @throws JaxenException */ protected void removeZustandAngabenChildElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:letztemodernisierung | " + "/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:verkaufstatus", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parentNode = (Element) node.getParentNode(); parentNode.removeChild(node); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java
/** * Upgrade <sonstige> elements to OpenImmo 1.2.3. * <p>//from www . j a va 2 s.co m * The option "KRANKENHAUS" for the "haustyp" attribute of <haus> * elements is placed in the <sonstige> element in version 1.2.3. * * @param doc OpenImmo document in version 1.2.2 * @throws JaxenException */ protected void upgradeSonstigeElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:haus[@haustyp]", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parent = (Element) node.getParentNode(); String value = StringUtils.trimToNull(node.getAttribute("haustyp")); if ("KRANKENHAUS".equalsIgnoreCase(value)) { parent.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "sonstige"); newNode.setAttribute("sonstige_typ", "KRANKENHAUS"); parent.appendChild(newNode); } } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java
/** * Upgrade <zinshaus_renditeobjekt> elements to OpenImmo 1.2.3. * <p>/*from www .ja v a 2 s .c om*/ * The options "PFLEGEHEIM", "SANATORIUM", "SENIORENHEIM", "BETREUTES-WOHNEN" * for the "haustyp" attribute of <haus> elements are placed in the * <zinshaus_renditeobjekt> element in version 1.2.3. * * @param doc OpenImmo document in version 1.2.2 * @throws JaxenException */ protected void upgradeZinshausRenditeobjektElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:haus[@haustyp]", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; Element parent = (Element) node.getParentNode(); String value = StringUtils.trimToNull(node.getAttribute("haustyp")); if ("PFLEGEHEIM".equalsIgnoreCase(value)) { parent.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "zinshaus_renditeobjekt"); newNode.setAttribute("zins_typ", "PFLEGEHEIM"); parent.appendChild(newNode); } else if ("SANATORIUM".equalsIgnoreCase(value)) { parent.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "zinshaus_renditeobjekt"); newNode.setAttribute("zins_typ", "SANATORIUM"); parent.appendChild(newNode); } else if ("SENIORENHEIM".equalsIgnoreCase(value)) { parent.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "zinshaus_renditeobjekt"); newNode.setAttribute("zins_typ", "SENIORENHEIM"); parent.appendChild(newNode); } else if ("BETREUTES-WOHNEN".equalsIgnoreCase(value)) { parent.removeChild(node); Element newNode = doc.createElementNS(StringUtils.EMPTY, "zinshaus_renditeobjekt"); newNode.setAttribute("zins_typ", "BETREUTES-WOHNEN"); parent.appendChild(newNode); } } }