Skip to content

Commit

Permalink
Fix stax parsing xml:space attribute and fix stax writer
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Sep 7, 2023
1 parent 1bb46cd commit 28c9f83
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mdo/reader-stax.vm
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> DEFAULT_ENTITIES;
static {
Map<String, String> entities = new HashMap<>();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 28c9f83

Please sign in to comment.