Skip to content

Commit b7187a7

Browse files
committed
Rename XmlGeneratorInitializer.setDTD() to XmlGeneratorInitializer.addDTD()
1 parent 06caa02 commit b7187a7

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/main/java/tools/jackson/dataformat/xml/ser/XmlGeneratorInitializer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public void initialize(SerializationConfig config, JsonGenerator g) throws Jacks
3131
}
3232
}
3333

34-
public XmlGeneratorInitializer setDTD(String rootName,
34+
public XmlGeneratorInitializer addDTD(String rootName,
3535
String systemId, String publicId,
3636
String internalSubset) {
37-
return setDTD(new DTD(rootName, systemId, publicId, internalSubset));
37+
return addDTD(new DTD(rootName, systemId, publicId, internalSubset));
3838
}
3939

40-
public XmlGeneratorInitializer setDTD(DTD dtd) {
40+
public XmlGeneratorInitializer addDTD(DTD dtd) {
4141
_dtd = dtd;
4242
return this;
4343
}

src/test/java/tools/jackson/dataformat/xml/ser/XmlGeneratorInitializerTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void testDTDWithOnlyRootElement() throws Exception
2020
{
2121
ObjectWriter w = MAPPER.writer().with(
2222
new XmlGeneratorInitializer()
23-
.setDTD("StringBean", null, null, null));
23+
.addDTD("StringBean", null, null, null));
2424
assertEquals(a2q("<!DOCTYPE StringBean>"
2525
+"<StringBean><text>test</text></StringBean>"),
2626
w.writeValueAsString(new StringBean("test")));
@@ -31,7 +31,7 @@ public void testDTDWithPublicId() throws Exception
3131
{
3232
ObjectWriter w = MAPPER.writer().with(
3333
new XmlGeneratorInitializer()
34-
.setDTD("StringBean", "system", "http://foo.bar", ""));
34+
.addDTD("StringBean", "system", "http://foo.bar", ""));
3535
assertEquals(a2q("<!DOCTYPE StringBean PUBLIC 'http://foo.bar' 'system'>"
3636
+"<StringBean><text>test</text></StringBean>"),
3737
w.writeValueAsString(new StringBean("test")));
@@ -42,7 +42,7 @@ public void testDTDWithSystemIdOnly() throws Exception
4242
{
4343
ObjectWriter w = MAPPER.writer().with(
4444
new XmlGeneratorInitializer()
45-
.setDTD("StringBean", "system", "", null));
45+
.addDTD("StringBean", "system", "", null));
4646
assertEquals(a2q("<!DOCTYPE StringBean SYSTEM 'system'>"
4747
+"<StringBean><text>test</text></StringBean>"),
4848
w.writeValueAsString(new StringBean("test")));
@@ -53,7 +53,7 @@ public void testDTDWithInternalSubset() throws Exception
5353
{
5454
ObjectWriter w = MAPPER.writer().with(
5555
new XmlGeneratorInitializer()
56-
.setDTD("StringBean", "system", "http://foo.bar", "<!ELEMENT root (#PCDATA)>"));
56+
.addDTD("StringBean", "system", "http://foo.bar", "<!ELEMENT root (#PCDATA)>"));
5757
assertEquals(a2q("<!DOCTYPE StringBean PUBLIC 'http://foo.bar' 'system' "
5858
+"[<!ELEMENT root (#PCDATA)>]>"
5959
+"<StringBean><text>test</text></StringBean>"),
@@ -69,7 +69,7 @@ public void testDTDWithXmlDeclaration() throws Exception
6969
.build();
7070
ObjectWriter w = mapper.writer().with(
7171
new XmlGeneratorInitializer()
72-
.setDTD("StringBean", "system", "http://foo.bar", null));
72+
.addDTD("StringBean", "system", "http://foo.bar", null));
7373
// XML declaration is emitted with single quotes, DOCTYPE with double quotes,
7474
// so cannot use a2q() on the whole string here.
7575
assertEquals("<?xml version='1.0' encoding='UTF-8'?>"
@@ -85,7 +85,7 @@ public void testDTDInvalidNoRoot() throws Exception
8585
try {
8686
/*ObjectWriter w =*/ MAPPER.writer().with(
8787
new XmlGeneratorInitializer()
88-
.setDTD("", null, null, null));
88+
.addDTD("", null, null, null));
8989
fail("Should not pass");
9090
} catch (IllegalArgumentException e) {
9191
verifyException(e, "Illegal argument for 'rootName': must be");

0 commit comments

Comments
 (0)