Index: data/mappaint-style.xsd
===================================================================
--- data/mappaint-style.xsd	(revision 9916)
+++ data/mappaint-style.xsd	(nonexistent)
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://josm.openstreetmap.de/mappaint-style-1.0"
-	xmlns:tns="http://josm.openstreetmap.de/mappaint-style-1.0" elementFormDefault="qualified">
-
-	<!--
-		Localized attributes (for example de.description are not supported by
-		xsd, so root element needs <anyAttribute/>
-	-->
-
-	<element name="rules" type="tns:root"/>
-
-	<complexType name="root">
-		<sequence>
-			<choice minOccurs="0" maxOccurs="unbounded">
-				<element name="rule" type="tns:rule" />
-			</choice>
-		</sequence>
-		<attribute name="name" type="string" />
-		<attribute name="author" type="string" />
-		<attribute name="version" type="string" />
-		<attribute name="shortdescription" type="string" />
-		<attribute name="description" type="string" />
-		<attribute name="link" type="string"/>
-		<attribute name="icon" type="string"/>
-
-		<anyAttribute processContents="skip"/>
-	</complexType>
-
-	<!-- TODO: ensure that at least one of results exists, but only one of each element, except for linemod which may have more,
-	scale is totally optional, but each of the two may come only once -->
-	<complexType name="rule">
-		<sequence>
-			<element name="condition" type="tns:condition" minOccurs="1" maxOccurs="unbounded" />
-			<choice minOccurs="1" maxOccurs="unbounded" >
-				<group ref="tns:results" />
-				<group ref="tns:scale" />
-			</choice>
-		</sequence>
-	</complexType>
-
-	<group name="results">
-		<choice>
-			<element name="icon" type="tns:icon" />
-			<element name="area" type="tns:area" />
-			<element name="line" type="tns:line" />
-			<element name="linemod" type="tns:linemod" maxOccurs="unbounded" />
-		</choice>
-	</group>
-
-	<group name="scale">
-		<choice>
-			<element name="scale_min" type="integer" />
-			<element name="scale_max" type="integer" />
-		</choice>
-	</group>
-
-	<complexType name="condition">
-		<!-- TODO restrict to k, k+v or k+b, other attribute combinations are illegal -->
-		<attribute name="k" type="string" use="required" />
-		<attribute name="v" type="string" />
-		<attribute name="b" type="tns:yesno" />
-	</complexType>
-
-	<complexType name="icon">
-		<attribute name="src" type="string" use="required" />
-		<attribute name="annotate" type="boolean" />
-		<attribute name="priority" type="integer" />
-	</complexType>
-
-	<complexType name="line">
-		<attribute name="width" type="integer" />
-		<attribute name="dashed" type="tns:dashed" />
-		<attribute name="realwidth" type="integer" />
-		<attribute name="colour" type="tns:color" />
-		<attribute name="dashedcolour" type="tns:color" />
-		<attribute name="priority" type="integer" />
-	</complexType>
-
-	<complexType name="area">
-		<attribute name="colour" type="tns:color" />
-		<attribute name="closed" type="boolean" />
-		<attribute name="priority" type="integer" />
-	</complexType>
-
-	<complexType name="linemod">
-		<attribute name="dashed" type="tns:dashed" />
-		<attribute name="realwidth" type="integer" />
-		<attribute name="colour" type="tns:color" />
-		<attribute name="dashedcolour" type="tns:color" />
-		<attribute name="mode" type="tns:modifier_mode" use="required" />
-		<attribute name="width" type="tns:width" />
-	</complexType>
-
-	<simpleType name="yesno">
-		<restriction base="string">
-			<enumeration value="yes"/>
-			<enumeration value="no"/>
-		</restriction>
-	</simpleType>
-
-	<simpleType name="dashed">
-		<restriction base="string">
-			<pattern value="\d+(,\d+)*"/>
-			<pattern value="(true|false)"/>
-		</restriction>
-	</simpleType>
-
-	<simpleType name="modifier_mode">
-		<restriction base="string">
-			<enumeration value="under"/>
-			<enumeration value="over"/>
-		</restriction>
-	</simpleType>
-
-	<simpleType name="color">
-		<restriction base="string">
-			<pattern value="([a-z0-9_]+#)?[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?"/>
-			<!-- name#color or color only, where color is 6 or 8 hex digits -->
-		</restriction>
-	</simpleType>
-
-	<simpleType name="width">
-		<restriction base="string">
-			<pattern value="\d+"/>
-			<pattern value="[+-]\d+"/>
-			<pattern value="\d+%"/>
-		</restriction>
-	</simpleType>
-</schema>
Index: src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java	(working copy)
@@ -38,7 +38,6 @@
 import org.openstreetmap.josm.gui.NavigatableComponent;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.mappaint.Cascade;
-import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement;
 import org.openstreetmap.josm.gui.mappaint.ElemStyles;
 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
 import org.openstreetmap.josm.gui.mappaint.MultiCascade;
@@ -46,7 +45,7 @@
 import org.openstreetmap.josm.gui.mappaint.StyleElementList;
 import org.openstreetmap.josm.gui.mappaint.StyleSource;
 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
-import org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSource;
+import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement;
 import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.gui.widgets.JosmTextArea;
 import org.openstreetmap.josm.tools.GBC;
@@ -422,9 +421,7 @@
     }
 
     private static String getSort(StyleSource s) {
-        if (s instanceof XmlStyleSource) {
-            return tr("xml");
-        } else if (s instanceof MapCSSStyleSource) {
+        if (s instanceof MapCSSStyleSource) {
             return tr("mapcss");
         } else {
             return tr("unknown");
Index: src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(working copy)
@@ -5,8 +5,6 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -29,7 +27,6 @@
 import org.openstreetmap.josm.gui.mappaint.styleelement.MapImage;
 import org.openstreetmap.josm.gui.mappaint.styleelement.NodeElement;
 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement;
-import org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSource;
 import org.openstreetmap.josm.gui.preferences.SourceEntry;
 import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference.MapPaintPrefHelper;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
@@ -279,54 +276,20 @@
     }
 
     private static StyleSource fromSourceEntry(SourceEntry entry) {
-        CachedFile cf = null;
         try {
-            Set<String> mimes = new HashSet<>();
-            mimes.addAll(Arrays.asList(XmlStyleSource.XML_STYLE_MIME_TYPES.split(", ")));
-            mimes.addAll(Arrays.asList(MapCSSStyleSource.MAPCSS_STYLE_MIME_TYPES.split(", ")));
-            cf = new CachedFile(entry.url).setHttpAccept(Utils.join(", ", mimes));
-            String zipEntryPath = cf.findZipEntryPath("mapcss", "style");
-            if (zipEntryPath != null) {
-                entry.isZip = true;
-                entry.zipEntryPath = zipEntryPath;
-                return new MapCSSStyleSource(entry);
-            }
-            zipEntryPath = cf.findZipEntryPath("xml", "style");
-            if (zipEntryPath != null)
-                return new XmlStyleSource(entry);
-            if (Utils.hasExtension(entry.url, "mapcss"))
-                return new MapCSSStyleSource(entry);
-            if (Utils.hasExtension(entry.url, "xml"))
-                return new XmlStyleSource(entry);
-            else {
-                try (InputStreamReader reader = new InputStreamReader(cf.getInputStream(), StandardCharsets.UTF_8)) {
-                    WHILE: while (true) {
-                        int c = reader.read();
-                        switch (c) {
-                            case -1:
-                                break WHILE;
-                            case ' ':
-                            case '\t':
-                            case '\n':
-                            case '\r':
-                                continue;
-                            case '<':
-                                return new XmlStyleSource(entry);
-                            default:
-                                return new MapCSSStyleSource(entry);
-                        }
-                    }
+            Set<String> mimes = new HashSet<>(Arrays.asList(MapCSSStyleSource.MAPCSS_STYLE_MIME_TYPES.split(", ")));
+            try (CachedFile cf = new CachedFile(entry.url).setHttpAccept(Utils.join(", ", mimes))) {
+                String zipEntryPath = cf.findZipEntryPath("mapcss", "style");
+                if (zipEntryPath != null) {
+                    entry.isZip = true;
+                    entry.zipEntryPath = zipEntryPath;
+                    return new MapCSSStyleSource(entry);
                 }
-                Main.warn("Could not detect style type. Using default (xml).");
-                return new XmlStyleSource(entry);
             }
-        } catch (IOException e) {
+            return new MapCSSStyleSource(entry);
+        } catch (Exception e) {
             Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", entry.url, e.toString()));
             Main.error(e);
-        } finally {
-            if (cf != null) {
-                cf.close();
-            }
         }
         return null;
     }
Index: src/org/openstreetmap/josm/gui/mappaint/xml/AreaPrototype.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/xml/AreaPrototype.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/mappaint/xml/AreaPrototype.java	(nonexistent)
@@ -1,30 +0,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.gui.mappaint.xml;
-
-import java.awt.Color;
-
-import org.openstreetmap.josm.gui.mappaint.Range;
-
-public class AreaPrototype extends Prototype {
-    public Color color;
-    public boolean closed; // if true, it does not apply to unclosed ways
-
-    public AreaPrototype(AreaPrototype a, Range range) {
-        super(range);
-        this.color = a.color;
-        this.closed = a.closed;
-        this.priority = a.priority;
-        this.conditions = a.conditions;
-    }
-
-    public AreaPrototype() {
-        init();
-    }
-
-    public final void init() {
-        priority = 0;
-        range = Range.ZERO_TO_INFINITY;
-        closed = false;
-        color = null;
-    }
-}
Index: src/org/openstreetmap/josm/gui/mappaint/xml/IconPrototype.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/xml/IconPrototype.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/mappaint/xml/IconPrototype.java	(nonexistent)
@@ -1,33 +0,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.gui.mappaint.xml;
-
-import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
-import org.openstreetmap.josm.gui.mappaint.Range;
-
-public class IconPrototype extends Prototype {
-
-    public IconReference icon;
-    public Boolean annotate;
-
-    public IconPrototype(IconPrototype i, Range range) {
-        super(range);
-        this.icon = i.icon;
-        this.annotate = i.annotate;
-        this.priority = i.priority;
-        this.conditions = i.conditions;
-    }
-
-    /**
-     * Constructs a new {@code IconPrototype}.
-     */
-    public IconPrototype() {
-        init();
-    }
-
-    public final void init() {
-        priority = 0;
-        range = Range.ZERO_TO_INFINITY;
-        icon = null;
-        annotate = null;
-    }
-}
Index: src/org/openstreetmap/josm/gui/mappaint/xml/LinePrototype.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/xml/LinePrototype.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/mappaint/xml/LinePrototype.java	(nonexistent)
@@ -1,90 +0,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.gui.mappaint.xml;
-
-import java.awt.Color;
-import java.util.List;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
-import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
-import org.openstreetmap.josm.gui.mappaint.Range;
-import org.openstreetmap.josm.tools.I18n;
-
-public class LinePrototype extends Prototype {
-
-    protected int width;
-    public Integer realWidth; // the real width of this line in meter
-    public Color color;
-    protected List<Float> dashed;
-    public Color dashedColor;
-
-    public LinePrototype(LinePrototype s, Range range) {
-        super(range);
-        this.width = s.width;
-        this.realWidth = s.realWidth;
-        this.color = s.color;
-        this.dashed = s.dashed;
-        this.dashedColor = s.dashedColor;
-        this.priority = s.priority;
-        this.conditions = s.conditions;
-    }
-
-    /**
-     * Constructs a new {@code LinePrototype}.
-     */
-    public LinePrototype() {
-        init();
-    }
-
-    public void init() {
-        priority = 0;
-        range = Range.ZERO_TO_INFINITY;
-        width = -1;
-        realWidth = null;
-        dashed = null;
-        dashedColor = null;
-        color = PaintColors.UNTAGGED.get();
-    }
-
-    public List<Float> getDashed() {
-        return dashed;
-    }
-
-    public void setDashed(List<Float> dashed) {
-        if (dashed == null || dashed.isEmpty()) {
-            this.dashed = null;
-            return;
-        }
-
-        boolean found = false;
-        for (Float f : dashed) {
-            if (f == null) {
-                this.dashed = null;
-                return;
-            }
-            if (f > 0) {
-                found = true;
-            }
-            if (f < 0) {
-                Main.error(I18n.tr("Illegal dash pattern, values must be positive"));
-                this.dashed = null;
-                return;
-            }
-        }
-        if (found) {
-            this.dashed = dashed;
-        } else {
-            Main.error(I18n.tr("Illegal dash pattern, at least one value must be > 0"));
-        }
-    }
-
-    public int getWidth() {
-        if (width == -1)
-            return MapPaintSettings.INSTANCE.getDefaultSegmentWidth();
-        return width;
-    }
-
-    public void setWidth(int width) {
-        this.width = width;
-    }
-}
Index: src/org/openstreetmap/josm/gui/mappaint/xml/LinemodPrototype.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/xml/LinemodPrototype.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/mappaint/xml/LinemodPrototype.java	(nonexistent)
@@ -1,68 +0,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.gui.mappaint.xml;
-
-import org.openstreetmap.josm.gui.mappaint.Range;
-
-public class LinemodPrototype extends LinePrototype implements Comparable<LinemodPrototype> {
-
-    public enum WidthMode { ABSOLUTE, PERCENT, OFFSET }
-
-    public WidthMode widthMode;
-    public boolean over;
-
-    public LinemodPrototype(LinemodPrototype s, Range range) {
-        super(s, range);
-        this.over = s.over;
-        this.widthMode = s.widthMode;
-    }
-
-    /**
-     * Constructs a new {@code LinemodPrototype}.
-     */
-    public LinemodPrototype() {
-        init();
-    }
-
-    @Override
-    public final void init() {
-        super.init();
-        over = true;
-        widthMode = WidthMode.ABSOLUTE;
-    }
-
-    /**
-     * get width for overlays
-     * @param ref reference width
-     * @return width according to {@link #widthMode} with a minimal value of 1
-     */
-    public float getWidth(float ref) {
-        float res;
-        if (widthMode == WidthMode.ABSOLUTE) {
-            res = width;
-        } else if (widthMode == WidthMode.OFFSET) {
-            res = ref + width;
-        } else {
-            if (width < 0) {
-                res = 0;
-            } else {
-                res = ref*width/100;
-            }
-        }
-        return res <= 0 ? 1 : res;
-    }
-
-    @Override
-    public int getWidth() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public int compareTo(LinemodPrototype s) {
-        if (s.priority != priority)
-            return s.priority > priority ? 1 : -1;
-            if (!over && s.over)
-                return -1;
-            // we have no idea how to order other objects :-)
-            return 0;
-    }
-}
Index: src/org/openstreetmap/josm/gui/mappaint/xml/Prototype.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/xml/Prototype.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/mappaint/xml/Prototype.java	(nonexistent)
@@ -1,60 +0,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.gui.mappaint.xml;
-
-import java.util.Collection;
-
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.OsmUtils;
-import org.openstreetmap.josm.gui.mappaint.Range;
-
-public abstract class Prototype {
-    // zoom range to display the feature
-    public Range range;
-
-    public int priority;
-    public String code;
-    public Collection<XmlCondition> conditions;
-
-    public Prototype(Range range) {
-        this.range = range;
-    }
-
-    /**
-     * Constructs a new {@code Prototype}.
-     */
-    public Prototype() {
-        // Allows subclassing
-    }
-
-    public String getCode() {
-        if (code == null) {
-            if (conditions == null || conditions.isEmpty()) {
-                code = "";
-            } else {
-                final StringBuilder sb = new StringBuilder();
-                for (XmlCondition r: conditions) {
-                    r.appendCode(sb);
-                }
-                code = sb.toString();
-            }
-        }
-        return code;
-    }
-
-    public boolean check(OsmPrimitive primitive) {
-        if (conditions == null)
-            return true;
-        for (XmlCondition r : conditions) {
-            String k = primitive.get(r.key);
-
-            if (k == null || (r.value != null && !k.equals(r.value)))
-                return false;
-
-            String bv = OsmUtils.getNamedOsmBoolean(r.boolValue);
-
-            if (bv != null && !bv.equals(OsmUtils.getNamedOsmBoolean(k)))
-                return false;
-        }
-        return true;
-    }
-}
Index: src/org/openstreetmap/josm/gui/mappaint/xml/XmlCondition.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/xml/XmlCondition.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/mappaint/xml/XmlCondition.java	(nonexistent)
@@ -1,50 +0,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.gui.mappaint.xml;
-
-import org.openstreetmap.josm.data.osm.OsmUtils;
-
-public class XmlCondition {
-
-    public String key;
-    public String value;
-    public String boolValue;
-
-    public XmlCondition() {
-      init();
-    }
-
-    public XmlCondition(XmlCondition c) {
-      key = c.key;
-      value = c.value;
-      boolValue = c.boolValue;
-    }
-
-    public String getKey() {
-        if (value != null)
-            return 'n' + key + '=' + value;
-        else if (boolValue != null)
-            return 'b' + key  + '=' + OsmUtils.getNamedOsmBoolean(boolValue);
-        else
-            return 'x' + key;
-    }
-
-    public final void init() {
-      key = value = boolValue = null;
-    }
-
-    @Override
-    public String toString() {
-      return "Rule["+key+','+(boolValue != null ? "b="+boolValue : "v="+value)+']';
-    }
-
-    public void appendCode(StringBuilder sb) {
-        sb.append("[k=").append(key);
-
-        if (boolValue != null)
-            sb.append(",b=").append(boolValue);
-        else
-            sb.append(",v=").append(value);
-
-        sb.append(']');
-    }
-}
Index: src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java	(nonexistent)
@@ -1,381 +0,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.gui.mappaint.xml;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.OsmUtils;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.mappaint.Cascade;
-import org.openstreetmap.josm.gui.mappaint.Keyword;
-import org.openstreetmap.josm.gui.mappaint.MultiCascade;
-import org.openstreetmap.josm.gui.mappaint.Range;
-import org.openstreetmap.josm.gui.mappaint.StyleKeys;
-import org.openstreetmap.josm.gui.mappaint.StyleSource;
-import org.openstreetmap.josm.gui.preferences.SourceEntry;
-import org.openstreetmap.josm.io.CachedFile;
-import org.openstreetmap.josm.tools.Utils;
-import org.openstreetmap.josm.tools.XmlObjectParser;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-public class XmlStyleSource extends StyleSource implements StyleKeys {
-
-    /**
-     * The accepted MIME types sent in the HTTP Accept header.
-     * @since 6867
-     */
-    public static final String XML_STYLE_MIME_TYPES =
-            "application/xml, text/xml, text/plain; q=0.8, application/zip, application/octet-stream; q=0.5";
-
-    protected final Map<String, IconPrototype> icons = new HashMap<>();
-    protected final Map<String, LinePrototype> lines = new HashMap<>();
-    protected final Map<String, LinemodPrototype> modifiers = new HashMap<>();
-    protected final Map<String, AreaPrototype> areas = new HashMap<>();
-    protected final List<IconPrototype> iconsList = new LinkedList<>();
-    protected final List<LinePrototype> linesList = new LinkedList<>();
-    protected final List<LinemodPrototype> modifiersList = new LinkedList<>();
-    protected final List<AreaPrototype> areasList = new LinkedList<>();
-
-    public XmlStyleSource(String url, String name, String shortdescription) {
-        super(url, name, shortdescription);
-    }
-
-    public XmlStyleSource(SourceEntry entry) {
-        super(entry);
-    }
-
-    @Override
-    protected void init() {
-        super.init();
-        icons.clear();
-        lines.clear();
-        modifiers.clear();
-        areas.clear();
-        iconsList.clear();
-        linesList.clear();
-        modifiersList.clear();
-        areasList.clear();
-    }
-
-    @Override
-    public void loadStyleSource() {
-        init();
-        try {
-            try (
-                InputStream in = getSourceInputStream();
-                InputStreamReader reader = new InputStreamReader(in, StandardCharsets.UTF_8)
-            ) {
-                XmlObjectParser parser = new XmlObjectParser(new XmlStyleSourceHandler(this));
-                parser.startWithValidation(reader,
-                        Main.getXMLBase()+"/mappaint-style-1.0",
-                        "resource://data/mappaint-style.xsd");
-                while (parser.hasNext());
-            }
-        } catch (IOException e) {
-            Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString()));
-            Main.error(e);
-            logError(e);
-        } catch (SAXParseException e) {
-            Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: [{1}:{2}] {3}",
-                    url, e.getLineNumber(), e.getColumnNumber(), e.getMessage()));
-            Main.error(e);
-            logError(e);
-        } catch (SAXException e) {
-            Main.warn(tr("Failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
-            Main.error(e);
-            logError(e);
-        }
-    }
-
-    @Override
-    public InputStream getSourceInputStream() throws IOException {
-        CachedFile cf = getCachedFile();
-        InputStream zip = cf.findZipEntryInputStream("xml", "style");
-        if (zip != null) {
-            zipIcons = cf.getFile();
-            return zip;
-        } else {
-            zipIcons = null;
-            return cf.getInputStream();
-        }
-    }
-
-    @Override
-    @SuppressWarnings("resource")
-    public CachedFile getCachedFile() throws IOException {
-        return new CachedFile(url).setHttpAccept(XML_STYLE_MIME_TYPES); // NOSONAR
-    }
-
-    private static class WayPrototypesRecord {
-        public LinePrototype line;
-        public List<LinemodPrototype> linemods;
-        public AreaPrototype area;
-    }
-
-    private <T extends Prototype> T update(T current, T candidate, Double scale, MultiCascade mc) {
-        if (requiresUpdate(current, candidate, scale, mc))
-            return candidate;
-        else
-            return current;
-    }
-
-    /**
-     * checks whether a certain match is better than the current match
-     * @param current can be null
-     * @param candidate the new Prototype that could be used instead
-     * @param scale ignored if null, otherwise checks if scale is within the range of candidate
-     * @param mc side effect: update the valid region for the current MultiCascade
-     * @return {@code true} if {@code candidate} is better than the current match
-     */
-    private static boolean requiresUpdate(Prototype current, Prototype candidate, Double scale, MultiCascade mc) {
-        if (current == null || candidate.priority >= current.priority) {
-            if (scale == null)
-                return true;
-
-            if (candidate.range.contains(scale)) {
-                mc.range = Range.cut(mc.range, candidate.range);
-                return true;
-            } else {
-                mc.range = mc.range.reduceAround(scale, candidate.range);
-                return false;
-            }
-        }
-        return false;
-    }
-
-    private IconPrototype getNode(OsmPrimitive primitive, Double scale, MultiCascade mc) {
-        IconPrototype icon = null;
-        for (String key : primitive.keySet()) {
-            String val = primitive.get(key);
-            IconPrototype p;
-            if ((p = icons.get('n' + key + '=' + val)) != null) {
-                icon = update(icon, p, scale, mc);
-            }
-            if ((p = icons.get('b' + key + '=' + OsmUtils.getNamedOsmBoolean(val))) != null) {
-                icon = update(icon, p, scale, mc);
-            }
-            if ((p = icons.get('x' + key)) != null) {
-                icon = update(icon, p, scale, mc);
-            }
-        }
-        for (IconPrototype s : iconsList) {
-            if (s.check(primitive)) {
-                icon = update(icon, s, scale, mc);
-            }
-        }
-        return icon;
-    }
-
-    /**
-     * @param primitive OSM primitive
-     * @param closed The primitive is a closed way or we pretend it is closed.
-     *  This is useful for multipolygon relations and outer ways of untagged
-     *  multipolygon relations.
-     * @param p helper
-     * @param scale scale
-     * @param mc multi cascade
-     */
-    private void get(OsmPrimitive primitive, boolean closed, WayPrototypesRecord p, Double scale, MultiCascade mc) {
-        String lineIdx = null;
-        Map<String, LinemodPrototype> overlayMap = new HashMap<>();
-        boolean isNotArea = primitive.isKeyFalse("area");
-        for (String key : primitive.keySet()) {
-            String val = primitive.get(key);
-            AreaPrototype styleArea;
-            LinePrototype styleLine;
-            LinemodPrototype styleLinemod;
-            String idx = 'n' + key + '=' + val;
-            if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) {
-                p.area = update(p.area, styleArea, scale, mc);
-            }
-            if ((styleLine = lines.get(idx)) != null) {
-                if (requiresUpdate(p.line, styleLine, scale, mc)) {
-                    p.line = styleLine;
-                    lineIdx = idx;
-                }
-            }
-            if ((styleLinemod = modifiers.get(idx)) != null) {
-                if (requiresUpdate(null, styleLinemod, scale, mc)) {
-                    overlayMap.put(idx, styleLinemod);
-                }
-            }
-            idx = 'b' + key + '=' + OsmUtils.getNamedOsmBoolean(val);
-            if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) {
-                p.area = update(p.area, styleArea, scale, mc);
-            }
-            if ((styleLine = lines.get(idx)) != null) {
-                if (requiresUpdate(p.line, styleLine, scale, mc)) {
-                    p.line = styleLine;
-                    lineIdx = idx;
-                }
-            }
-            if ((styleLinemod = modifiers.get(idx)) != null) {
-                if (requiresUpdate(null, styleLinemod, scale, mc)) {
-                    overlayMap.put(idx, styleLinemod);
-                }
-            }
-            idx = 'x' + key;
-            if ((styleArea = areas.get(idx)) != null && (closed || !styleArea.closed) && !isNotArea) {
-                p.area = update(p.area, styleArea, scale, mc);
-            }
-            if ((styleLine = lines.get(idx)) != null) {
-                if (requiresUpdate(p.line, styleLine, scale, mc)) {
-                    p.line = styleLine;
-                    lineIdx = idx;
-                }
-            }
-            if ((styleLinemod = modifiers.get(idx)) != null) {
-                if (requiresUpdate(null, styleLinemod, scale, mc)) {
-                    overlayMap.put(idx, styleLinemod);
-                }
-            }
-        }
-        for (AreaPrototype s : areasList) {
-            if ((closed || !s.closed) && !isNotArea && s.check(primitive)) {
-                p.area = update(p.area, s, scale, mc);
-            }
-        }
-        for (LinePrototype s : linesList) {
-            if (s.check(primitive)) {
-                p.line = update(p.line, s, scale, mc);
-            }
-        }
-        for (LinemodPrototype s : modifiersList) {
-            if (s.check(primitive)) {
-                if (requiresUpdate(null, s, scale, mc)) {
-                    overlayMap.put(s.getCode(), s);
-                }
-            }
-        }
-        overlayMap.remove(lineIdx); // do not use overlay if linestyle is from the same rule (example: railway=tram)
-        if (!overlayMap.isEmpty()) {
-            List<LinemodPrototype> tmp = new LinkedList<>();
-            if (p.linemods != null) {
-                tmp.addAll(p.linemods);
-            }
-            tmp.addAll(overlayMap.values());
-            Collections.sort(tmp);
-            p.linemods = tmp;
-        }
-    }
-
-    public void add(XmlCondition c, Collection<XmlCondition> conditions, Prototype prot) {
-         if (conditions != null) {
-            prot.conditions = conditions;
-            if (prot instanceof IconPrototype) {
-                iconsList.add((IconPrototype) prot);
-            } else if (prot instanceof LinemodPrototype) {
-                modifiersList.add((LinemodPrototype) prot);
-            } else if (prot instanceof LinePrototype) {
-                linesList.add((LinePrototype) prot);
-            } else if (prot instanceof AreaPrototype) {
-                areasList.add((AreaPrototype) prot);
-            } else
-                throw new RuntimeException();
-         } else {
-             String key = c.getKey();
-            prot.code = key;
-            if (prot instanceof IconPrototype) {
-                icons.put(key, (IconPrototype) prot);
-            } else if (prot instanceof LinemodPrototype) {
-               modifiers.put(key, (LinemodPrototype) prot);
-            } else if (prot instanceof LinePrototype) {
-                lines.put(key, (LinePrototype) prot);
-            } else if (prot instanceof AreaPrototype) {
-                areas.put(key, (AreaPrototype) prot);
-            } else
-                throw new RuntimeException();
-         }
-     }
-
-    @Override
-    public void apply(MultiCascade mc, OsmPrimitive osm, double scale, boolean pretendWayIsClosed) {
-        Cascade def = mc.getOrCreateCascade("default");
-        boolean useMinMaxScale = Main.pref.getBoolean("mappaint.zoomLevelDisplay", false);
-
-        if (osm instanceof Node || (osm instanceof Relation && "restriction".equals(osm.get("type")))) {
-            IconPrototype icon = getNode(osm, useMinMaxScale ? scale : null, mc);
-            if (icon != null) {
-                def.put(ICON_IMAGE, icon.icon);
-                if (osm instanceof Node) {
-                    if (icon.annotate != null) {
-                        if (icon.annotate) {
-                            def.put(TEXT, Keyword.AUTO);
-                        } else {
-                            def.remove(TEXT);
-                        }
-                    }
-                }
-            }
-        } else if (osm instanceof Way || (osm instanceof Relation && ((Relation) osm).isMultipolygon())) {
-            WayPrototypesRecord p = new WayPrototypesRecord();
-            get(osm, pretendWayIsClosed || !(osm instanceof Way) || ((Way) osm).isClosed(), p, useMinMaxScale ? scale : null, mc);
-            if (p.line != null) {
-                def.put(WIDTH, new Float(p.line.getWidth()));
-                def.putOrClear(REAL_WIDTH, p.line.realWidth != null ? new Float(p.line.realWidth) : null);
-                def.putOrClear(COLOR, p.line.color);
-                if (p.line.color != null) {
-                    int alpha = p.line.color.getAlpha();
-                    if (alpha != 255) {
-                        def.put(OPACITY, Utils.color_int2float(alpha));
-                    }
-                }
-                def.putOrClear(DASHES, p.line.getDashed());
-                def.putOrClear(DASHES_BACKGROUND_COLOR, p.line.dashedColor);
-            }
-            Float refWidth = def.get(WIDTH, null, Float.class);
-            if (refWidth != null && p.linemods != null) {
-                int numOver = 0, numUnder = 0;
-
-                while (mc.hasLayer(String.format("over_%d", ++numOver)));
-                while (mc.hasLayer(String.format("under_%d", ++numUnder)));
-
-                for (LinemodPrototype mod : p.linemods) {
-                    Cascade c;
-                    if (mod.over) {
-                        String layer = String.format("over_%d", numOver);
-                        c = mc.getOrCreateCascade(layer);
-                        c.put(OBJECT_Z_INDEX, new Float(numOver));
-                        ++numOver;
-                    } else {
-                        String layer = String.format("under_%d", numUnder);
-                        c = mc.getOrCreateCascade(layer);
-                        c.put(OBJECT_Z_INDEX, new Float(-numUnder));
-                        ++numUnder;
-                    }
-                    c.put(WIDTH, new Float(mod.getWidth(refWidth)));
-                    c.putOrClear(COLOR, mod.color);
-                    if (mod.color != null) {
-                        int alpha = mod.color.getAlpha();
-                        if (alpha != 255) {
-                            c.put(OPACITY, Utils.color_int2float(alpha));
-                        }
-                    }
-                    c.putOrClear(DASHES, mod.getDashed());
-                    c.putOrClear(DASHES_BACKGROUND_COLOR, mod.dashedColor);
-                }
-            }
-            if (p.area != null) {
-                def.putOrClear(FILL_COLOR, p.area.color);
-                def.putOrClear(TEXT_POSITION, Keyword.CENTER);
-                def.putOrClear(TEXT, Keyword.AUTO);
-                def.remove(FILL_IMAGE);
-            }
-        }
-    }
-}
Index: src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java	(nonexistent)
@@ -1,309 +0,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.gui.mappaint.xml;
-
-import java.awt.Color;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedList;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
-import org.openstreetmap.josm.gui.mappaint.Range;
-import org.openstreetmap.josm.tools.ColorHelper;
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class XmlStyleSourceHandler extends DefaultHandler {
-    private boolean inDoc, inRule, inCondition, inLine, inLineMod, inIcon, inArea, inScaleMax, inScaleMin;
-    private boolean hadLine, hadLineMod, hadIcon, hadArea;
-    private final RuleElem rule = new RuleElem();
-
-    private final XmlStyleSource style;
-
-    static class RuleElem {
-        private final XmlCondition cond = new XmlCondition();
-        private Collection<XmlCondition> conditions;
-        private double scaleMax;
-        private double scaleMin;
-        private final LinePrototype line = new LinePrototype();
-        private final LinemodPrototype linemod = new LinemodPrototype();
-        private final AreaPrototype area = new AreaPrototype();
-        private IconPrototype icon = new IconPrototype();
-        public void init() {
-            conditions = null;
-            scaleMax = Double.POSITIVE_INFINITY;
-            scaleMin = 0;
-            line.init();
-            cond.init();
-            linemod.init();
-            area.init();
-            icon.init();
-        }
-    }
-
-    public XmlStyleSourceHandler(XmlStyleSource style) {
-        this.style = style;
-        inDoc = inRule = inCondition = inLine = inIcon = inArea = false;
-        rule.init();
-    }
-
-    private Color convertColor(String colString) {
-        int i = colString.indexOf('#');
-        Color ret;
-        if (i < 0) {
-            ret = Main.pref.getColor("mappaint."+style.getPrefName()+'.'+colString, Color.red);
-        } else if (i == 0) {
-            ret = ColorHelper.html2color(colString);
-        } else {
-            ret = Main.pref.getColor("mappaint."+style.getPrefName()+'.'+colString.substring(0, i),
-                    ColorHelper.html2color(colString.substring(i)));
-        }
-        return ret;
-    }
-
-    @Override
-    public void startDocument() {
-        inDoc = true;
-    }
-
-    @Override
-    public void endDocument() {
-        inDoc = false;
-    }
-
-    private void error(String message) {
-        String warning = style.getDisplayString() + " (" + rule.cond.key + '=' + rule.cond.value + "): " + message;
-        Main.warn(warning);
-        style.logError(new Exception(warning));
-    }
-
-    private void startElementLine(String qName, Attributes atts, LinePrototype line) {
-        for (int count = 0; count < atts.getLength(); count++) {
-            switch (atts.getQName(count)) {
-            case "width":
-                String val = atts.getValue(count);
-                if (!(val.startsWith("+") || val.startsWith("-") || val.endsWith("%"))) {
-                    line.setWidth(Integer.parseInt(val));
-                }
-                break;
-            case "colour":
-                line.color = convertColor(atts.getValue(count));
-                break;
-            case "realwidth":
-                line.realWidth = Integer.valueOf(atts.getValue(count));
-                break;
-            case "dashed":
-                Float[] dashed;
-                try {
-                    String[] parts = atts.getValue(count).split(",");
-                    dashed = new Float[parts.length];
-                    for (int i = 0; i < parts.length; i++) {
-                        dashed[i] = (float) Integer.parseInt(parts[i]);
-                    }
-                } catch (NumberFormatException nfe) {
-                    boolean isDashed = Boolean.parseBoolean(atts.getValue(count));
-                    if (isDashed) {
-                        dashed = new Float[]{9f};
-                    } else {
-                        dashed = null;
-                    }
-                }
-                line.setDashed(dashed == null ? null : Arrays.asList(dashed));
-                break;
-            case "dashedcolour":
-                line.dashedColor = convertColor(atts.getValue(count));
-                break;
-            case "priority":
-                line.priority = Integer.parseInt(atts.getValue(count));
-                break;
-            case "mode":
-                if (line instanceof LinemodPrototype)
-                    break;
-            default:
-                error("The element \"" + qName + "\" has unknown attribute \"" + atts.getQName(count) + "\"!");
-            }
-        }
-    }
-
-    private void startElementLinemod(String qName, Attributes atts, LinemodPrototype line) {
-        startElementLine(qName, atts, line);
-        for (int count = 0; count < atts.getLength(); count++) {
-            switch (atts.getQName(count)) {
-            case "width":
-                String val = atts.getValue(count);
-                if (val.startsWith("+")) {
-                    line.setWidth(Integer.parseInt(val.substring(1)));
-                    line.widthMode = LinemodPrototype.WidthMode.OFFSET;
-                } else if (val.startsWith("-")) {
-                    line.setWidth(Integer.parseInt(val));
-                    line.widthMode = LinemodPrototype.WidthMode.OFFSET;
-                } else if (val.endsWith("%")) {
-                    line.setWidth(Integer.parseInt(val.substring(0, val.length()-1)));
-                    line.widthMode = LinemodPrototype.WidthMode.PERCENT;
-                } else {
-                    line.setWidth(Integer.parseInt(val));
-                }
-                break;
-            case "mode":
-                line.over = !"under".equals(atts.getValue(count));
-                break;
-            }
-        }
-    }
-
-    @Override
-    public void startElement(String uri, String name, String qName, Attributes atts) {
-        if (inDoc) {
-            switch(qName) {
-            case "rule":
-                inRule = true;
-                break;
-            case "rules":
-                if (style.name == null) {
-                    style.name = atts.getValue("name");
-                }
-                if (style.title == null) {
-                    style.title = atts.getValue("shortdescription");
-                }
-                if (style.icon == null) {
-                    style.icon = atts.getValue("icon");
-                }
-                break;
-            case "scale_max":
-                inScaleMax = true;
-                break;
-            case "scale_min":
-                inScaleMin = true;
-                break;
-            case "condition":
-                if (inRule) {
-                    inCondition = true;
-                    XmlCondition c = rule.cond;
-                    if (c.key != null) {
-                        if (rule.conditions == null) {
-                            rule.conditions = new LinkedList<>();
-                        }
-                        rule.conditions.add(new XmlCondition(rule.cond));
-                        c = new XmlCondition();
-                        rule.conditions.add(c);
-                    }
-                    for (int count = 0; count < atts.getLength(); count++) {
-                        switch (atts.getQName(count)) {
-                        case "k":
-                            c.key = atts.getValue(count);
-                            break;
-                        case "v":
-                            c.value = atts.getValue(count);
-                            break;
-                        case "b":
-                            c.boolValue = atts.getValue(count);
-                            break;
-                        default:
-                            error("The element \"" + qName + "\" has unknown attribute \"" + atts.getQName(count) + "\"!");
-                        }
-                    }
-                    if (c.key == null) {
-                        error("The condition has no key!");
-                    }
-                }
-                break;
-            case "line":
-                hadLine = inLine = true;
-                startElementLine(qName, atts, rule.line);
-                break;
-            case "linemod":
-                hadLineMod = inLineMod = true;
-                startElementLinemod(qName, atts, rule.linemod);
-                break;
-            case "icon":
-                inIcon = true;
-                for (int count = 0; count < atts.getLength(); count++) {
-                    switch (atts.getQName(count)) {
-                    case "src":
-                        IconReference icon = new IconReference(atts.getValue(count), style);
-                        hadIcon = (icon != null);
-                        rule.icon.icon = icon;
-                        break;
-                    case "annotate":
-                        rule.icon.annotate = Boolean.valueOf(atts.getValue(count));
-                        break;
-                    case "priority":
-                        rule.icon.priority = Integer.parseInt(atts.getValue(count));
-                        break;
-                    default:
-                        error("The element \"" + qName + "\" has unknown attribute \"" + atts.getQName(count) + "\"!");
-                    }
-                }
-                break;
-            case "area":
-                hadArea = inArea = true;
-                for (int count = 0; count < atts.getLength(); count++) {
-                    switch (atts.getQName(count)) {
-                    case "colour":
-                        rule.area.color = convertColor(atts.getValue(count));
-                        break;
-                    case "closed":
-                        rule.area.closed = Boolean.parseBoolean(atts.getValue(count));
-                        break;
-                    case "priority":
-                        rule.area.priority = Integer.parseInt(atts.getValue(count));
-                        break;
-                    default:
-                        error("The element \"" + qName + "\" has unknown attribute \"" + atts.getQName(count) + "\"!");
-                    }
-                }
-                break;
-            default:
-                error("The element \"" + qName + "\" is unknown!");
-            }
-        }
-    }
-
-    @Override
-    public void endElement(String uri, String name, String qName) {
-        if (inRule && "rule".equals(qName)) {
-            if (hadLine) {
-                style.add(rule.cond, rule.conditions,
-                        new LinePrototype(rule.line, new Range(rule.scaleMin, rule.scaleMax)));
-            }
-            if (hadLineMod) {
-                style.add(rule.cond, rule.conditions,
-                        new LinemodPrototype(rule.linemod, new Range(rule.scaleMin, rule.scaleMax)));
-            }
-            if (hadIcon) {
-                style.add(rule.cond, rule.conditions,
-                        new IconPrototype(rule.icon, new Range(rule.scaleMin, rule.scaleMax)));
-            }
-            if (hadArea) {
-                style.add(rule.cond, rule.conditions,
-                        new AreaPrototype(rule.area, new Range(rule.scaleMin, rule.scaleMax)));
-            }
-            inRule = false;
-            hadLine = hadLineMod = hadIcon = hadArea = false;
-            rule.init();
-        } else if (inCondition && "condition".equals(qName)) {
-            inCondition = false;
-        } else if (inLine && "line".equals(qName)) {
-            inLine = false;
-        } else if (inLineMod && "linemod".equals(qName)) {
-            inLineMod = false;
-        } else if (inIcon && "icon".equals(qName)) {
-            inIcon = false;
-        } else if (inArea && "area".equals(qName)) {
-            inArea = false;
-        } else if ("scale_max".equals(qName)) {
-            inScaleMax = false;
-        } else if ("scale_min".equals(qName)) {
-            inScaleMin = false;
-        }
-    }
-
-    @Override
-    public void characters(char[] ch, int start, int length) {
-        if (inScaleMax) {
-            rule.scaleMax = Long.parseLong(new String(ch, start, length));
-        } else if (inScaleMin) {
-            rule.scaleMin = Long.parseLong(new String(ch, start, length));
-        }
-    }
-}
Index: src/org/openstreetmap/josm/gui/mappaint/xml/package-info.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/xml/package-info.java	(revision 9916)
+++ src/org/openstreetmap/josm/gui/mappaint/xml/package-info.java	(nonexistent)
@@ -1,7 +0,0 @@
-// License: GPL. For details, see LICENSE file.
-
-/**
- * Drawing system based on XML map styles. This is a legacy system, not maintained anymore.
- * For reference, see <a href="https://josm.openstreetmap.de/wiki/Styles/LegacyStandard">JOSM wiki</a>
- */
-package org.openstreetmap.josm.gui.mappaint.xml;
