From 2cc360da0f576da20978980fe6498219eb924a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Tue, 5 Sep 2023 22:03:39 +0200 Subject: [PATCH] Fixed XML major version detection --- .../decompiler/flash/importers/SwfXmlImporter.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java index 2292155a5..9636504b0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/SwfXmlImporter.java @@ -221,7 +221,7 @@ public class SwfXmlImporter { xmlReader.nextTag(); xmlReader.require(XMLStreamConstants.START_ELEMENT, null, "swf"); - processElement(xmlReader, swf, swf, null); + processElement(xmlReader, swf, swf, null, MAX_XML_IMPORT_VERSION_MAJOR); } swf.clearAllCache(); @@ -290,7 +290,7 @@ public class SwfXmlImporter { }*/ } - private void processElement(XMLStreamReader reader, Object obj, SWF swf, Tag tag) throws XMLStreamException { + private void processElement(XMLStreamReader reader, Object obj, SWF swf, Tag tag, int xmlExportMajor) throws XMLStreamException { // Check if element started and start if needed if(!reader.isStartElement()) { reader.nextTag(); @@ -305,11 +305,10 @@ public class SwfXmlImporter { String value = reader.getAttributeValue(i); attributes.put(name, value); } - int xmlExportMajor = 1; - int xmlExportMinor = 0; + if ("SWF".equals(attributes.get("type"))) { - + int xmlExportMinor = 0; if (attributes.containsKey("_xmlExportMajor")) { xmlExportMajor = Integer.parseInt(attributes.get("_xmlExportMajor")); } @@ -447,7 +446,7 @@ public class SwfXmlImporter { tag = (Tag) childObj; } - processElement(reader, childObj, swf, tag); + processElement(reader, childObj, swf, tag, xmlExportMajor); ret = childObj; } else { String isNullAttr = attributes.get("isNull");