Example usage for org.w3c.dom Element removeAttribute

List of usage examples for org.w3c.dom Element removeAttribute

Introduction

In this page you can find the example usage for org.w3c.dom Element removeAttribute.

Prototype

public void removeAttribute(String name) throws DOMException;

Source Link

Document

Removes an attribute by name.

Usage

From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_2.java

/**
 * Downgrade <boden> elements to OpenImmo 1.2.1.
 * <p>//from w  w  w  .  ja  v  a2s  .c o m
 * The attributes "FERTIGPARKETT", "LAMINAT", "LINOLEUM" for &lt;boden&gt;
 * elements are not available in version 1.2.1.
 * <p>
 * Any occurences of these values are removed.
 *
 * @param doc OpenImmo document in version 1.2.2
 * @throws JaxenException
 */
protected void downgradeBodenElements(Document doc) throws JaxenException {
    List nodes = XmlUtils.newXPath(
            "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:boden[@FERTIGPARKETT or @LAMINAT or @LINOLEUM]",
            doc).selectNodes(doc);
    for (Object item : nodes) {
        Element node = (Element) item;
        node.removeAttribute("FERTIGPARKETT");
        node.removeAttribute("LAMINAT");
        node.removeAttribute("LINOLEUM");
    }
}

From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_2.java

/**
 * Downgrade &lt;einzelhandel&gt; elements to OpenImmo 1.2.1.
 * <p>/*from w ww  .  jav  a2  s  . com*/
 * The options "KAUFHAUS", "FACTORY_OUTLET", "KIOSK", "VERKAUFSFLAECHE",
 * "AUSSTELLUNGSFLAECHE" for the "handel_typ" attribute of
 * &lt;einzelhandel&gt; elements are not available in version 1.2.1.
 * <p>
 * Any occurence of these values is removed.
 *
 * @param doc OpenImmo document in version 1.2.2
 * @throws JaxenException
 */
protected void downgradeEinzelhandelElements(Document doc) throws JaxenException {
    List nodes = XmlUtils.newXPath(
            "/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:einzelhandel[@handel_typ]",
            doc).selectNodes(doc);
    for (Object item : nodes) {
        Element node = (Element) item;
        String value = StringUtils.trimToNull(node.getAttribute("handel_typ"));
        if ("KAUFHAUS".equalsIgnoreCase(value))
            node.removeAttribute("handel_typ");
        else if ("FACTORY_OUTLET".equalsIgnoreCase(value))
            node.removeAttribute("handel_typ");
        else if ("KIOSK".equalsIgnoreCase(value))
            node.removeAttribute("handel_typ");
        else if ("VERKAUFSFLAECHE".equalsIgnoreCase(value))
            node.removeAttribute("handel_typ");
        else if ("AUSSTELLUNGSFLAECHE".equalsIgnoreCase(value))
            node.removeAttribute("handel_typ");
    }
}

From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_2.java

/**
 * Downgrade &lt;freizeitimmobilie_gewerblich&gt; elements to OpenImmo 1.2.1.
 * <p>/* w w w  . j a  va  2s .c  om*/
 * The option "FREIZEITANLAGE" for the "freizeit_typ" attribute of
 * &lt;freizeitimmobilie_gewerblich&gt; elements is not available in version
 * 1.2.1.
 * <p>
 * Any occurence of these values is removed.
 *
 * @param doc OpenImmo document in version 1.2.2
 * @throws JaxenException
 */
protected void downgradeFreizeitimmobilieGewerblichElements(Document doc) throws JaxenException {
    List nodes = XmlUtils.newXPath(
            "/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:freizeitimmobilie_gewerblich[@freizeit_typ]",
            doc).selectNodes(doc);
    for (Object item : nodes) {
        Element node = (Element) item;
        String value = StringUtils.trimToNull(node.getAttribute("freizeit_typ"));
        if ("FREIZEITANLAGE".equalsIgnoreCase(value))
            node.removeAttribute("freizeit_typ");
    }
}

From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_2.java

/**
 * Downgrade &lt;einzelhandel&gt; elements to OpenImmo 1.2.1.
 * <p>//w ww  .  j ava 2s.  c  o  m
 * The options "BAR", "CAFE", "DISCOTHEK", "RESTAURANT", "RAUCHERLOKAL",
 * "EINRAUMLOKAL" for the "gastgew_typ" attribute of
 * &lt;gastgewerbe&gt; elements are not available in version 1.2.1.
 * <p>
 * Any occurence of these values is removed.
 *
 * @param doc OpenImmo document in version 1.2.2
 * @throws JaxenException
 */
protected void downgradeGastgewerbeElements(Document doc) throws JaxenException {
    List nodes = XmlUtils.newXPath(
            "/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:gastgewerbe[@gastgew_typ]",
            doc).selectNodes(doc);
    for (Object item : nodes) {
        Element node = (Element) item;
        String value = StringUtils.trimToNull(node.getAttribute("gastgew_typ"));
        if ("BAR".equalsIgnoreCase(value))
            node.removeAttribute("gastgew_typ");
        else if ("CAFE".equalsIgnoreCase(value))
            node.removeAttribute("gastgew_typ");
        else if ("DISCOTHEK".equalsIgnoreCase(value))
            node.removeAttribute("gastgew_typ");
        else if ("RESTAURANT".equalsIgnoreCase(value))
            node.removeAttribute("gastgew_typ");
        else if ("RAUCHERLOKAL".equalsIgnoreCase(value))
            node.removeAttribute("gastgew_typ");
        else if ("EINRAUMLOKAL".equalsIgnoreCase(value))
            node.removeAttribute("gastgew_typ");
    }
}

From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_2.java

/**
 * Downgrade &lt;grundstueck&gt; elements to OpenImmo 1.2.1.
 * <p>/*from   w w w .j ava 2 s  .  co m*/
 * The option "GEWERBEPARK" for the "grundst_typ" attribute of
 * &lt;grundstueck&gt; elements is not available in version 1.2.1.
 * <p>
 * Any occurence of these values is removed.
 *
 * @param doc OpenImmo document in version 1.2.2
 * @throws JaxenException
 */
protected void downgradeGrundstueckElements(Document doc) throws JaxenException {
    List nodes = XmlUtils.newXPath(
            "/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:grundstueck[@grundst_typ]",
            doc).selectNodes(doc);
    for (Object item : nodes) {
        Element node = (Element) item;
        String value = StringUtils.trimToNull(node.getAttribute("grundst_typ"));
        if ("GEWERBEPARK".equalsIgnoreCase(value))
            node.removeAttribute("grundst_typ");
    }
}

From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_2.java

/**
 * Downgrade &lt;hallen_lager_prod&gt; elements to OpenImmo 1.2.1.
 * <p>//w ww.  j a va 2  s.  co m
 * The options "INDUSTRIEHALLE", "LAGERFLAECHEN", "LAGER_MIT_FREIFLAECHE",
 * "SPEDITIONSLAGER", "KUEHLHAUS" for the "hallen_typ" attribute of
 * &lt;hallen_lager_prod&gt; elements are not available in version 1.2.1.
 * <p>
 * Any occurence of "KUEHLHAUS" is removed. Other unsupported options are
 * replaced by "HALLE" or "LAGER".
 *
 * @param doc OpenImmo document in version 1.2.2
 * @throws JaxenException
 */
protected void downgradeHallenLagerProdElements(Document doc) throws JaxenException {
    List nodes = XmlUtils.newXPath(
            "/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:hallen_lager_prod[@hallen_typ]",
            doc).selectNodes(doc);
    for (Object item : nodes) {
        Element node = (Element) item;
        String value = StringUtils.trimToNull(node.getAttribute("hallen_typ"));
        if ("INDUSTRIEHALLE".equalsIgnoreCase(value))
            node.setAttribute("hallen_typ", "HALLE");
        else if ("LAGERFLAECHEN".equalsIgnoreCase(value))
            node.setAttribute("hallen_typ", "LAGER");
        else if ("LAGER_MIT_FREIFLAECHE".equalsIgnoreCase(value))
            node.setAttribute("hallen_typ", "LAGER");
        else if ("SPEDITIONSLAGER".equalsIgnoreCase(value))
            node.setAttribute("hallen_typ", "LAGER");
        else if ("KUEHLHAUS".equalsIgnoreCase(value))
            node.removeAttribute("hallen_typ");
    }
}

From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_2.java

/**
 * Downgrade &lt;haus&gt; elements to OpenImmo 1.2.1.
 * <p>/*w  ww . j a v a 2 s.  c  o m*/
 * The option "KEINE_ANGABE" for the "haustyp" attribute of &lt;haus&gt;
 * elements are not available in version 1.2.1.
 * <p>
 * Any occurence of these values is removed.
 *
 * @param doc OpenImmo document in version 1.2.2
 * @throws JaxenException
 */
protected void downgradeHausElements(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;
        String value = StringUtils.trimToNull(node.getAttribute("haustyp"));
        if ("KEINE_ANGABE".equalsIgnoreCase(value))
            node.removeAttribute("haustyp");
    }
}

From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_2.java

/**
 * Downgrade &lt;uebertragung&gt; elements to OpenImmo 1.2.1.
 * <p>/*w  w  w  .ja va2 s .com*/
 * The attribute "timestamp" for &lt;uebertragung&gt; elements is not
 * available in version 1.2.1.
 * <p>
 * Any occurences of these values are removed.
 *
 * @param doc OpenImmo document in version 1.2.2
 * @throws JaxenException
 */
protected void downgradeUebertragungElements(Document doc) throws JaxenException {
    List nodes = XmlUtils.newXPath("/io:openimmo/io:uebertragung[@timestamp]", doc).selectNodes(doc);
    for (Object item : nodes) {
        Element node = (Element) item;
        node.removeAttribute("timestamp");
    }
}

From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_2.java

/**
 * Downgrade &lt;wohnung&gt; elements to OpenImmo 1.2.1.
 * <p>//from  w  w w  .ja  v  a2s  .co  m
 * The option "KEINE_ANGABE" for the "wohnungtyp" attribute of &lt;wohnung&gt;
 * elements is not available in version 1.2.1.
 * <p>
 * Any occurence of these values is removed.
 *
 * @param doc OpenImmo document in version 1.2.2
 * @throws JaxenException
 */
protected void downgradeWohnungElements(Document doc) throws JaxenException {
    List nodes = XmlUtils.newXPath(
            "/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:wohnung[@wohnungtyp]",
            doc).selectNodes(doc);
    for (Object item : nodes) {
        Element node = (Element) item;
        String value = StringUtils.trimToNull(node.getAttribute("wohnungtyp"));
        if ("KEINE_ANGABE".equalsIgnoreCase(value))
            node.removeAttribute("wohnungtyp");
    }
}

From source file:org.openestate.io.openimmo.converters.OpenImmo_1_2_3.java

/**
 * Downgrade &lt;ausricht_balkon_terrasse&gt; elements to OpenImmo 1.2.2.
 * <p>//from  w  ww  . ja  v a 2 s.  c  o  m
 * The attributes "NORDOST", "NORDWEST", "SUEDOST", "SUEDWEST" for
 * &lt;ausricht_balkon_terrasse&gt; elements are not available in version
 * 1.2.2.
 * <p>
 * Any occurences of these values are replaced by the single components -
 * e.g. "NORDOST" is removed and "NORD" + "OST" is set.
 *
 * @param doc OpenImmo document in version 1.2.3
 * @throws JaxenException
 */
protected void downgradeAusrichtBalkonTerrasseElements(Document doc) throws JaxenException {
    List nodes = XmlUtils.newXPath(
            "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:ausricht_balkon_terrasse[@NORDOST or @NORDWEST or @SUEDOST or @SUEDWEST]",
            doc).selectNodes(doc);
    for (Object item : nodes) {
        Element node = (Element) item;
        if (node.hasAttribute("NORDOST")) {
            String value = StringUtils.trimToEmpty(node.getAttribute("NORDOST")).toLowerCase();
            if (value.equals("1") || value.equals("true")) {
                node.setAttribute("NORD", "true");
                node.setAttribute("OST", "true");
            }
            node.removeAttribute("NORDOST");
        }
        if (node.hasAttribute("NORDWEST")) {
            String value = StringUtils.trimToEmpty(node.getAttribute("NORDWEST")).toLowerCase();
            if (value.equals("1") || value.equals("true")) {
                node.setAttribute("NORD", "true");
                node.setAttribute("WEST", "true");
            }
            node.removeAttribute("NORDWEST");
        }
        if (node.hasAttribute("SUEDOST")) {
            String value = StringUtils.trimToEmpty(node.getAttribute("SUEDOST")).toLowerCase();
            if (value.equals("1") || value.equals("true")) {
                node.setAttribute("SUED", "true");
                node.setAttribute("OST", "true");
            }
            node.removeAttribute("SUEDOST");
        }
        if (node.hasAttribute("SUEDWEST")) {
            String value = StringUtils.trimToEmpty(node.getAttribute("SUEDWEST")).toLowerCase();
            if (value.equals("1") || value.equals("true")) {
                node.setAttribute("SUED", "true");
                node.setAttribute("WEST", "true");
            }
            node.removeAttribute("SUEDWEST");
        }
    }
}