Consider the following xml snippet.
<s1>
S1 Tag: s1 content 1
<test1>Test1 Tag: content</test1>
S1 Tag: s1 content 2
<test2>Test2 Tag: content</test2>
S1 Tag: s1 content 3
</s1>
I want to extract <s1>
tag text (S1 Tag: s1 content 1, S1 Tag: s1 content 2, S1 Tag: s1 content 3 ) and all of its child tags (<test1>
and <test2>
) along with its content (Test1 Tag: content, Test2 Tag: content).
The output could be in any format e.g. (finally i have to persist it in db and will retrieve to produce the same xml again)
S1 tag: S1 Tag: s1 content 1
test1 tag: Test1 Tag: content
S1 Tag: s1 content 2
test2 tag: Test2 Tag: content
S1 Tag: s1 content 3