📜  java 解析 xml 字符串 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:05.411000             🧑  作者: Mango

代码示例1
public static Document loadXMLFromString(String xml) throws Exception
{
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    InputSource is = new InputSource(new StringReader(xml));
    return builder.parse(is);
}