Trivial fixes to the generated stax readers (#1204)

This commit is contained in:
Guillaume Nodet 2023-07-18 22:56:07 +02:00 committed by GitHub
parent fbc945b366
commit 4a5b6c5f2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -65,6 +65,11 @@ import javax.xml.transform.stream.StreamSource;
@Generated
public class ${className} {
/**
* XSI namespace
*/
private static final String XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance";
private static final Map<String, String> DEFAULT_ENTITIES;
static {
Map<String, String> entities = new HashMap<>();
@ -508,7 +513,7 @@ public class ${className} {
String tagName = parser.getLocalName();
${classUcapName}.Builder ${classLcapName} = ${classUcapName}.newBuilder(true);
#if ( $locationTracking )
if (addLocationInformation){
if (addLocationInformation) {
${classLcapName}.location("", new InputLocation(parser.getLocation().getLineNumber(), parser.getLocation().getColumnNumber(), source));
}
#end
@ -516,7 +521,7 @@ public class ${className} {
String name = parser.getAttributeLocalName(i);
String ns = parser.getAttributeNamespace(i);
String value = parser.getAttributeValue(i);
if ("http://www.w3.org/2001/XMLSchema-instance".equals(ns)) {
if (XSI_NAMESPACE.equals(ns)) {
// just ignore attributes with non-default namespace (for example: xmlns:xsi)
#if ( $class == $root )
} else if ("xmlns".equals(name)) {