XPath base query to return the element within a tag/ the max length in value =============================================================================
We have large XML data file. XMLSPY is not able to open this file.
Given a list of elements containing text:
<root>
<Person>
<AttachText>text text text ...</AttachText>
<AttachText>text text text ...</AttachText>
</Person>
</root>
I like to find out whether data exist for AttachText element and it size/length.
I tried with Grep/Sed in Linux, but I did not get desired result.
I'm not sure how to accomplish it. I like to pick up the brain of this forum for some ideas.
Thank in helping.
Is it possible to use xmlstarlet to get the result?
you might try awk:
awk -F"[<>]" '$3 {print $3,length($3)}' file