mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add xml
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.dromara.hutool.json;
|
||||
|
||||
import org.dromara.hutool.core.io.resource.ResourceUtil;
|
||||
import org.dromara.hutool.core.xml.XPathUtil;
|
||||
import org.dromara.hutool.core.xml.XmlUtil;
|
||||
import org.dromara.hutool.json.xml.JSONXMLSerializer;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
@@ -13,7 +14,7 @@ public class IssueI676ITTest {
|
||||
public void parseXMLTest() {
|
||||
final JSONObject jsonObject = JSONUtil.parseObj(ResourceUtil.readUtf8Str("issueI676IT.json"));
|
||||
final String xmlStr = JSONXMLSerializer.toXml(jsonObject, null, (String) null);
|
||||
final String content = String.valueOf(XmlUtil.getByXPath("/page/orderItems[1]/content", XmlUtil.readXML(xmlStr), XPathConstants.STRING));
|
||||
final String content = String.valueOf(XPathUtil.getByXPath("/page/orderItems[1]/content", XmlUtil.readXml(xmlStr), XPathConstants.STRING));
|
||||
Assertions.assertEquals(content, "bar1");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user