mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-24 18:04:54 +08:00
add test
This commit is contained in:
parent
4417e5cd00
commit
3085d29f51
@ -332,4 +332,20 @@ public class XmlUtilTest {
|
||||
final String name = doc.getDocumentElement().getAttribute("name");
|
||||
Assert.assertEquals("aaaa", name);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void issueI5DO8ETest(){
|
||||
// 增加子节点后,格式会错乱,JDK的bug
|
||||
XmlUtil.setNamespaceAware(false);
|
||||
final String xmlStr = ResourceUtil.readUtf8Str("issueI5DO8E.xml");
|
||||
final Document doc = XmlUtil.readXML(xmlStr);
|
||||
|
||||
final Element item = doc.createElement("item");
|
||||
item.setAttribute("id", "cover-image");
|
||||
final Element manifestEl = XmlUtil.getElementByXPath("//package/manifest", doc);
|
||||
manifestEl.appendChild(item);
|
||||
|
||||
Console.log(XmlUtil.format(doc));
|
||||
}
|
||||
}
|
||||
|
9
hutool-core/src/test/resources/issueI5DO8E.xml
Normal file
9
hutool-core/src/test/resources/issueI5DO8E.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<package xmlns="http://www.idpf.org/2007/opf"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
unique-identifier="bookId" version="2.0">
|
||||
<manifest>
|
||||
<item href="toc.ncx" id="ncx" media-type="application/x-dtbncx+xml"/>
|
||||
</manifest>
|
||||
<spine toc="ncx"></spine>
|
||||
</package>
|
Loading…
Reference in New Issue
Block a user