Read xml file

Iam new to shell script.
How to read xmlfile using shellscript(without awk),and Store record by record in file .

My xml file:

<root>

<header>
<HeaderData1>header1</HeaderData1>
<HeaderData2>header2</HeaderData2>
</header>

<detailsRecord>
<DetailRecord1>detail1</DetailRecord1>
<DetailRecord2>detail2</DetailRecord2>
<detailsRecord>

<detailsRecord>
<DetailRecord1>detail3</DetailRecord1>
<DetailRecord2>detail4</DetailRecord2>

<detailsRecord>

<trailer>
<trailer>trailer1</trailer>
</trailer>

</root>

Thanks Lot.

You can uses PERL or PHP...... works great.

Neo

What are records for you ? All the data that appear between the tags ?

If it is, this sed will do it.

sed -n -e 's_.*>\(.*\)<.*_\1_p' input.xml > record.txt