Skip to content

Commit 4a5b6c5

Browse files
authored
Trivial fixes to the generated stax readers (#1204)
1 parent fbc945b commit 4a5b6c5

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
@@ -65,6 +65,11 @@ import javax.xml.transform.stream.StreamSource;
6565
@Generated
6666
public class ${className} {
6767

68+
/**
69+
* XSI namespace
70+
*/
71+
private static final String XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance";
72+
6873
private static final Map<String, String> DEFAULT_ENTITIES;
6974
static {
7075
Map<String, String> entities = new HashMap<>();
@@ -508,15 +513,15 @@ public class ${className} {
508513
String tagName = parser.getLocalName();
509514
${classUcapName}.Builder ${classLcapName} = ${classUcapName}.newBuilder(true);
510515
#if ( $locationTracking )
511-
if (addLocationInformation){
516+
if (addLocationInformation) {
512517
${classLcapName}.location("", new InputLocation(parser.getLocation().getLineNumber(), parser.getLocation().getColumnNumber(), source));
513518
}
514519
#end
515520
for (int i = parser.getAttributeCount() - 1; i >= 0; i--) {
516521
String name = parser.getAttributeLocalName(i);
517522
String ns = parser.getAttributeNamespace(i);
518523
String value = parser.getAttributeValue(i);
519-
if ("http://www.w3.org/2001/XMLSchema-instance".equals(ns)) {
524+
if (XSI_NAMESPACE.equals(ns)) {
520525
// just ignore attributes with non-default namespace (for example: xmlns:xsi)
521526
#if ( $class == $root )
522527
} else if ("xmlns".equals(name)) {

0 commit comments

Comments
 (0)