Code to insert arbitrary XML string into XML document by XPath?

If the snippet is well-formed most DOM implementations I've seen will also support the non-standard DocumentFragment node type which allows you to inject dom nodes from string.

If the snippet is well-formed most DOM implementations I've seen will also support the non-standard DocumentFragment node type which allows you to inject dom nodes from string. EDIT: Quick Google search throws up some JavaDocs: download.oracle.com/javase/1.4.2/docs/ap... IIRC the api works like this (pseudo code): parent = find_parent_node_of_fragment(document); fragment = document. CreateDocumentFragment(); fragment.

AppendXML("xmlstring"); parent. AppendChild(fragment); If you don't have this luxury or if your string is not well formed there is the option to inject CDATA. If you can't make do with injecting CDATA (because you essentially want to affect nodes that follow, for instance the new node must become the parent of old nodes which will be enclosed in the new document), you could try an XSLT transformation.

I suspect what I was trying to do is non-trivial and would have required a much larger framework than what I had time for. I ended up abandoning this endeavor.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions