mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
support omit xml declaration
This commit is contained in:
@@ -124,4 +124,14 @@ public class XmlUtilTest {
|
||||
Document doc = XmlUtil.readXML("test.xml");
|
||||
Assert.assertNotNull(doc);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mapToXmlTestWithOmitXmlDeclaration() {
|
||||
|
||||
Map<String, Object> map = MapBuilder.create(new LinkedHashMap<String, Object>())
|
||||
.put("name", "ddatsh")
|
||||
.build();
|
||||
String xml=XmlUtil.mapToXmlStr(map,true);
|
||||
Assert.assertEquals(xml,"<xml><name>ddatsh</name></xml>");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user