0

I'm using javax.xml.xpath to read nodes out of a XML-DOM and to create Java-Objects from the read data. After changing the data of these objects and perhaps creating new objects, I would like to write them back to the XML-DOM. So I was wondering if it is possible to use xpath to also create nodes at specific positions in the XML-DOM. I am not sure if xpath is designed to write to DOM because its a "Query"-Language. But on the other hand SQL is also a query-language and is able to write data to databases.

So my general question is: Is it possible to create DOM-Nodes with XPaths?

4

2 回答 2

0

不,您将需要使用低级 DOM 方法来创建新节点。

您确定您使用的是正确的方法吗?整个应用程序可以用 XSLT 更容易地编写吗?即使你想使用基于 Java 树的 API,为什么 DOM 与 JDOM 和 XOM 等后续树模型相比如此缓慢和笨拙?

于 2013-10-20T19:06:41.203 回答
0

不,据我所知,这是不可能的。但是返回的元素是“活的”,这意味着对它们所做的任何更改都会直接反映在 dom 中。

于 2013-10-20T18:43:46.130 回答