Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将保存我的 XML 的 byte[] 或 String 转换为 DOM 文档?
我需要这个才能在 Documnet 上执行 XPath。
您需要一个DocumentBuilder并使用通过StringReader配置了 XML 字符串的InputSource来调用parse()它。
parse()
不要parse()直接使用字符串调用,因为它会将该字符串解释为引用 XML 的 URI!