From 28c9f83eefaa60209ba14062994b05dfba77e566 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Wed, 6 Sep 2023 13:27:34 +0200 Subject: [PATCH] Fix stax parsing xml:space attribute and fix stax writer --- src/mdo/reader-stax.vm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mdo/reader-stax.vm b/src/mdo/reader-stax.vm index 2aa7c7a2d5f4..f0ac08164856 100644 --- a/src/mdo/reader-stax.vm +++ b/src/mdo/reader-stax.vm @@ -70,6 +70,11 @@ public class ${className} { */ private static final String XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance"; + /** + * XML namespace + */ + private static final String XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"; + private static final Map DEFAULT_ENTITIES; static { Map entities = new HashMap<>(); @@ -521,8 +526,8 @@ public class ${className} { String name = parser.getAttributeLocalName(i); String ns = parser.getAttributeNamespace(i); String value = parser.getAttributeValue(i); - if (XSI_NAMESPACE.equals(ns)) { - // just ignore attributes with non-default namespace (for example: xmlns:xsi) + if (XSI_NAMESPACE.equals(ns) || XML_NAMESPACE.equals(ns)) { + // just ignore attributes with non-default namespace (for example: xsi and xml) #if ( $class == $root ) } else if ("xmlns".equals(name)) { // ignore xmlns attribute in root class, which is a reserved attribute name