From ec7dc3d5cbb4ff97a5b2c0361c7f9a661739af96 Mon Sep 17 00:00:00 2001 From: Carlos Amengual Date: Tue, 25 Jun 2024 14:05:15 +0200 Subject: [PATCH] The `version` attribute isn't part of SVG anymore, just check for 1.2 --- .../io/sf/carte/echosvg/anim/dom/SAXSVGDocumentFactory.java | 5 ++--- .../main/java/io/sf/carte/echosvg/bridge/BridgeContext.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/SAXSVGDocumentFactory.java b/echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/SAXSVGDocumentFactory.java index 2dc32a6a0..981db3fe4 100644 --- a/echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/SAXSVGDocumentFactory.java +++ b/echosvg-anim/src/main/java/io/sf/carte/echosvg/anim/dom/SAXSVGDocumentFactory.java @@ -348,12 +348,11 @@ public SVGDocument createDocument(String ns, String root, String uri, Reader r) @Override public DOMImplementation getDOMImplementation(String ver) { - if (ver == null || ver.length() == 0 || ver.equals("1.0") || ver.equals("1.1")) { + if (!"1.2".equals(ver)) { return SVGDOMImplementation.getDOMImplementation(); - } else if (ver.equals("1.2")) { + } else { return SVG12DOMImplementation.getDOMImplementation(); } - throw new RuntimeException("Unsupport SVG version '" + ver + "'"); } /** diff --git a/echosvg-bridge/src/main/java/io/sf/carte/echosvg/bridge/BridgeContext.java b/echosvg-bridge/src/main/java/io/sf/carte/echosvg/bridge/BridgeContext.java index f7d5d14fb..7dd360ff7 100644 --- a/echosvg-bridge/src/main/java/io/sf/carte/echosvg/bridge/BridgeContext.java +++ b/echosvg-bridge/src/main/java/io/sf/carte/echosvg/bridge/BridgeContext.java @@ -1979,7 +1979,7 @@ public List getBridgeExtensions(Document doc) { Element root = ((SVGOMDocument) doc).getRootElement(); String ver = root.getAttributeNS(null, SVGConstants.SVG_VERSION_ATTRIBUTE); BridgeExtension svgBE; - if ((ver.length() == 0) || ver.equals("1.0") || ver.equals("1.1")) + if (!"1.2".equals(ver)) svgBE = new SVGBridgeExtension(); else svgBE = new SVG12BridgeExtension();