List of usage examples for org.w3c.dom Element removeAttribute
public void removeAttribute(String name) throws DOMException;
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_5.java
/** * Downgrade <erschliessung> elements to OpenImmo 1.2.4. * <p>/*from w w w . j a v a 2 s. co m*/ * The option "ORTSUEBLICHERSCHLOSSEN" for the "erschl_attr" attribute of * <erschliessung> elements is not available in version 1.2.4. * <p> * Any occurence of these values are removed. * * @param doc OpenImmo document in version 1.2.5 * @throws JaxenException */ protected void downgradeErschliessungElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:erschliessung[@erschl_attr]", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; String value = StringUtils.trimToNull(node.getAttribute("erschl_attr")); if ("ORTSUEBLICHERSCHLOSSEN".equalsIgnoreCase(value)) node.removeAttribute("erschl_attr"); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_5.java
/** * Downgrade <zustand> elements to OpenImmo 1.2.4. * <p>//from ww w . j a va 2 s . c o m * The options "TEIL_SANIERT", "VOLL_SANIERT", "SANIERUNGSBEDUERFTIG" for the * "zustand_art" attribute of <zustand> elements are not available in * version 1.2.4. * <p> * Any occurence of the "TEIL_SANIERT" value is replaced by the * "TEIL_VOLLSANIERT" value. * <p> * Any occurence of the "VOLL_SANIERT" value is replaced by the * "TEIL_VOLLSANIERT" value. * <p> * Any occurence of the "SANIERUNGSBEDUERFTIG" value is removed. * * @param doc OpenImmo document in version 1.2.5 * @throws JaxenException */ protected void downgradeZustandElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:zustand[@zustand_art]", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; String value = StringUtils.trimToNull(node.getAttribute("zustand_art")); if ("TEIL_SANIERT".equalsIgnoreCase(value)) node.setAttribute("zustand_art", "TEIL_VOLLSANIERT"); else if ("VOLL_SANIERT".equalsIgnoreCase(value)) node.setAttribute("zustand_art", "TEIL_VOLLSANIERT"); else if ("SANIERUNGSBEDUERFTIG".equalsIgnoreCase(value)) node.removeAttribute("zustand_art"); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_6.java
/** * Downgrade <boden> elements to OpenImmo 1.2.5. * <p>/*from w w w . ja va 2s . com*/ * The attribute "GRANIT" of <boden> elements are not available in * OpenImmo 1.2.5. * * @param doc OpenImmo document in version 1.2.6 * @throws JaxenException */ protected void downgradeBodenElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:boden[@GRANIT]", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; node.removeAttribute("GRANIT"); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_6.java
/** * Downgrade <kaufpreis> elements to OpenImmo 1.2.5. * <p>/*from w ww . ja va2 s . c om*/ * The attribute "auf_anfrage" of <kaufpreis> elements are not available * in OpenImmo 1.2.5. * * @param doc OpenImmo document in version 1.2.6 * @throws JaxenException */ protected void downgradeKaufpreisElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:preise/io:kaufpreis[@auf_anfrage]", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; node.removeAttribute("auf_anfrage"); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_6.java
/** * Downgrade <energietyp> elements to OpenImmo 1.2.5. * <p>/*from w ww .j a va 2 s . c o m*/ * The attributes "MINERGIEBAUWEISE", "MINERGIE_ZERTIFIZIERT" of * <energietyp> elements are not available in OpenImmo 1.2.5. * * @param doc OpenImmo document in version 1.2.6 * @throws JaxenException */ protected void downgradeEnergietypElements(Document doc) throws JaxenException { List nodes = XmlUtils.newXPath( "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:energietyp[@MINERGIEBAUWEISE or @MINERGIE_ZERTIFIZIERT]", doc).selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; node.removeAttribute("MINERGIEBAUWEISE"); node.removeAttribute("MINERGIE_ZERTIFIZIERT"); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_7.java
/** * Downgrade <anhang> elements to OpenImmo 1.2.6. * <p>/*from w w w . j a v a2s .c om*/ * The options "EPASS-SKALA", "ANBOBJURL" for the "gruppe" attribute of * <anhang> elements are not available in version 1.2.6 * * @param doc OpenImmo document in version 1.2.7 * @throws JaxenException */ protected void downgradeAnhangElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:anhang[@gruppe] | " + "/io:openimmo/io:anbieter/io:immobilie/io:anhaenge/io:anhang[@gruppe]", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; String value = StringUtils.trimToNull(node.getAttribute("gruppe")); if ("EPASS-SKALA".equalsIgnoreCase(value)) node.removeAttribute("gruppe"); else if ("ANBOBJURL".equalsIgnoreCase(value)) node.removeAttribute("gruppe"); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_7.java
/** * Downgrade <befeuerung> elements to OpenImmo 1.2.6. * <p>/*from w ww . j a v a2s .com*/ * The attributes "KOHLE", "HOLZ", "FLUESSIGGAS" of <befeuerung> * elements are not available in OpenImmo 1.2.6. * * @param doc OpenImmo document in version 1.2.7 * @throws JaxenException */ protected void downgradeBefeuerungElements(Document doc) throws JaxenException { List nodes = XmlUtils.newXPath( "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:befeuerung[@KOHLE or @HOLZ or @FLUESSIGGAS]", doc).selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; node.removeAttribute("KOHLE"); node.removeAttribute("HOLZ"); node.removeAttribute("FLUESSIGGAS"); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_7.java
/** * Downgrade <summemietenetto> elements to OpenImmo 1.2.6. * <p>//from www .ja v a 2 s.c om * The attribute "summemieteust" of <summemietenetto> elements are * renamed to "sonstigemieteust" in OpenImmo 1.2.6. * * @param doc OpenImmo document in version 1.2.7 * @throws JaxenException */ protected void downgradeSummemietenettoElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:preise/io:summemietenetto[@summemieteust]", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; String value = StringUtils.trimToNull(node.getAttribute("summemieteust")); if (value != null) node.setAttribute("sonstigemieteust", value); node.removeAttribute("summemieteust"); } }
From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_7.java
/** * Upgrade <summemietenetto> elements to OpenImmo 1.2.7. * <p>/*from ww w .ja v a2s .c o m*/ * The attribute "sonstigemieteust" of <summemietenetto> elements is * renamed to "summemieteust" in OpenImmo 1.2.7. * * @param doc OpenImmo document in version 1.2.6 * @throws JaxenException */ protected void upgradeSummemietenettoElements(Document doc) throws JaxenException { List nodes = XmlUtils .newXPath("/io:openimmo/io:anbieter/io:immobilie/io:preise/io:summemietenetto[@sonstigemieteust]", doc) .selectNodes(doc); for (Object item : nodes) { Element node = (Element) item; String value = StringUtils.trimToNull(node.getAttribute("sonstigemieteust")); if (value != null) node.setAttribute("summemieteust", value); node.removeAttribute("sonstigemieteust"); } }
From source file:org.openmrs.module.formentry.PublishInfoPath.java
private static void prepareManifest(File tempDir, String url, String namespace, String solutionVersion, String taskPaneCaption, String taskPaneInitialUrl, String submitUrl) { File manifest = findManifest(tempDir); if (manifest == null) { log.warn("Missing manifest!"); return;//w ww . jav a 2 s. c o m } try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(manifest); Element elem = getSingleElement(doc, "xsf:xDocumentClass"); if (elem == null) { log.warn("Could not locate xsf:xDocumentClass element in manifest!"); return; } elem.setAttribute("solutionVersion", solutionVersion); if (elem.getAttribute("name") != null) elem.removeAttribute("name"); elem.setAttribute("trustSetting", "manual"); elem.setAttribute("trustLevel", "domain"); elem.setAttribute("publishUrl", url); elem.setAttribute("xmlns:openmrs", namespace); // Find xsf:taskpane element elem = getSingleElement(doc, "xsf:taskpane"); if (elem != null) { elem.setAttribute("caption", taskPaneCaption); elem.setAttribute("href", taskPaneInitialUrl); } else { log.warn("Could not locate xsf:taskpane element within manifest"); } elem = getSingleElement(doc, "xsf:useHttpHandler"); if (elem != null) { elem.setAttribute("href", submitUrl); } writeXml(doc, manifest.getPath()); } catch (ParserConfigurationException e) { log.error("Error parsing form data", e); } catch (SAXException e) { log.error("Error parsing form data", e); } catch (IOException e) { log.error("Error parsing form data", e); } }