Skip to content

Commit 28c9f83

Browse files
committed
Fix stax parsing xml:space attribute and fix stax writer
1 parent 1bb46cd commit 28c9f83

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/mdo/reader-stax.vm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public class ${className} {
7070
*/
7171
private static final String XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance";
7272

73+
/**
74+
* XML namespace
75+
*/
76+
private static final String XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
77+
7378
private static final Map<String, String> DEFAULT_ENTITIES;
7479
static {
7580
Map<String, String> entities = new HashMap<>();
@@ -521,8 +526,8 @@ public class ${className} {
521526
String name = parser.getAttributeLocalName(i);
522527
String ns = parser.getAttributeNamespace(i);
523528
String value = parser.getAttributeValue(i);
524-
if (XSI_NAMESPACE.equals(ns)) {
525-
// just ignore attributes with non-default namespace (for example: xmlns:xsi)
529+
if (XSI_NAMESPACE.equals(ns) || XML_NAMESPACE.equals(ns)) {
530+
// just ignore attributes with non-default namespace (for example: xsi and xml)
526531
#if ( $class == $root )
527532
} else if ("xmlns".equals(name)) {
528533
// ignore xmlns attribute in root class, which is a reserved attribute name

0 commit comments

Comments
 (0)