I have problem when using JOOX for transforming XMLs. I am doing some changes to element matching the fieldTag
I have a code as following:
Match xml = $(new StringReader(content.toString()));
Match find = xml.find(fieldTag);
Iterator<Element> iterator = find.iterator();
while(iterator.hasNext()){
Element next = iterator.next();
String text = $(next).text();
if(text.length() == 0) continue;
next.setNodeValue("....");
}
return xml.toString();
However , for example an XML like this is input:
<Body>
<A>ABC</A>
<B></B>
</Body>
this is what i get as result:
<Body>
<A>transformed</A>
<B/>
</Body>
You can notice that Element B is a self closed XML tag. Does anyone know that how do I make it to be <B></B
??