Skip to content

Commit 3930d6f

Browse files
committed
Merge branch '2.11' into 2.12
2 parents ab17f00 + 55fd5f3 commit 3930d6f

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

release-notes/CREDITS-2.x

+5
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ Luke Korth ([email protected])
6161
* Reported #366: XML containing xsi:nil is improperly parsed
6262
(2.10.2)
6363

64+
Martin Vysny (mvysny@github)
65+
66+
* Reported #395: Namespace repairing generates xmlns definitions for xml: prefix (which is implicit)
67+
(2.10.5)
68+
6469
Alexei Volkov (softkot@github)
6570

6671
* Reported #294: XML parser error with nested same element names

release-notes/VERSION-2.x

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ No changes since 2.10.x
3030

3131
2.10.5 (not yet released)
3232

33-
-
33+
#395: Namespace repairing generates xmlns definitions for xml: prefix (which is implicit)
34+
(reported by Martin V)
35+
- Upgrade Woodstox dependency to 6.2.0 (minor fix to namespace binding)
3436

3537
2.10.4 (03-May-2020)
3638

src/test/java/com/fasterxml/jackson/dataformat/xml/ser/TestNamespaces.java

+20-5
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,41 @@ public void setName(String name) {
1818
this.name = name;
1919
}
2020
}
21-
21+
22+
static class Issue395 {
23+
@JacksonXmlProperty(isAttribute = true, namespace = "http://www.w3.org/XML/1998/namespace",
24+
localName = "lang")
25+
public String lang = "en-US";
26+
}
27+
2228
/*
2329
/**********************************************************
2430
/* Unit tests
2531
/**********************************************************
2632
*/
27-
28-
// [Issue-26]: should prefer the "default namespace"
33+
34+
private final XmlMapper MAPPER = newMapper();
35+
36+
// [dataformat-xml#26]: should prefer the "default namespace"
2937
public void testRootNamespace() throws Exception
3038
{
3139
Person person = new Person();
3240
person.setName( "hello" );
3341

34-
XmlMapper xmlMapper = new XmlMapper();
35-
String xml = xmlMapper.writeValueAsString(person);
42+
String xml = MAPPER.writeValueAsString(person);
3643

3744
// should use "the default namespace"...
3845
final String PREFIX = "<person xmlns=";
3946
if (!xml.startsWith(PREFIX)) {
4047
fail("Expected XML to begin with '"+PREFIX+"', instead got: "+xml);
4148
}
4249
}
50+
51+
// [dataformat-xml#395]: should not bind standard `xml` namespace to anything
52+
public void testXmlNs() throws Exception
53+
{
54+
String xml = MAPPER.writeValueAsString(new Issue395());
55+
// System.err.println("XML: "+xml);
56+
assertEquals("<Issue395 xml:lang=\"en-US\"/>", xml.trim());
57+
}
4358
}

0 commit comments

Comments
 (0)