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コンテンツを含む文字列があります。
String str = "<history><message from="Alice" to="Bob" /></history>";
そして、このxmlコンテンツをいくつかの要素(org.dom4j.DOMElement)に追加したいと思います。どうやってするの? 私はこれを試しました:
myElement.addText(str);
しかし、それは私にちょうどエスケープされたテキストコンテンツを与えます。
Dom4jを使用してXMLフラグメントを別のDocumentオブジェクトに解析し、そのDocumentオブジェクトのルート要素をターゲットドキュメントの適切な場所に追加する必要があります。