I have an example of an xml I want to parse
a
There is underscore-java library. Or it's java 8 port. I am the maintainer of the project. Live example
import com.github.underscore.lodash.U;
import java.util.Map;
public class Main {
@SuppressWarnings("unchecked")
public static void main(String[] args) {
Map map = U.fromXmlMap(
"\r\n" +
" \r\n" +
"\r\n" +
" attribute 1 of detail a \r\n" +
" attribute 2 of detail a \r\n" +
" attribute 3 of detail a \r\n" +
"\r\n" +
" \r\n" +
"\r\n" +
" \r\n" +
" attribute 1 of detail b \r\n" +
" attribute 2 of detail b \r\n" +
"\r\n" +
" \r\n" +
"\r\n" +
"\r\n" +
"");
System.out.println(map);
// {Details={detail-a={detail=[ attribute 1 of detail a , attribute 2 of detail a , attribute 3 of detail a ]},
// detail-b={detail=[ attribute 1 of detail b , attribute 2 of detail b ]}}, #omit-xml-declaration=yes}
}
}