I have a xml like this:

            <Publication> myPublication0</Publication>
            <Publication> myPublication<bookName> my book</bookName></Publication>
            <Publication> myPublication1</Publication>
            <Publication> myPublication2<bookName> my book2</bookName>asd</Publication>

and i want to read through java program and want output like

myPublication<bookName> my book</bookName>
myPublication2<bookName> my book2</bookName>asd

please tell how to get given output

read the input
process the input to output
look at the output.

if you need to work with xml using Java, JDom is a stable and very well documented library that can help you there.

nope. all you need can be found at the link I gave you earlier.