Dom4j: wrap all elements with tags?

This is my code which uses xpath expression to avoid recursion as you've requested.

This is my code which uses xpath expression //* to avoid recursion as you've requested: public static void main(String args) throws DocumentException { SAXReader saxReader = new SAXReader(); String xml = "titletitle"; Document document = saxReader. Read(new StringReader(xml)); List nodes = document. SelectNodes("//*"); for (Iterator iterator = nodes.iterator(); iterator.hasNext();) { Node currentNode = iterator.next(); DefaultElement newElement = new DefaultElement("any"); Element parent = currentNode.getParent(); if (parent!

= null) { List contentList = parent.content(); int index = contentList. IndexOf(currentNode); parent. Remove(currentNode); newElement.

Add(currentNode); contentList. Add(index, newElement); } } Element rootElement = document.getRootElement(); DefaultElement newRootElement = new DefaultElement("any"); document. SetRootElement(newRootElement); newRootElement.

Add(rootElement); System.out. Println(document.asXML()); } This is my output: titletitle Hope this helps.

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