replacing string in an XML file

Hi all,

I need to replace string in XML file..XML file like
<dependency>
<groupId>fr.orange.portail.ear</groupId>
<artifactId>_AdminServicesEAR</artifactId>
<version>1.0.0-20080521.085352-1</version>
<type>ear</type>
</dependency>
<dependency>
<groupId>fr.orange.portail.ear</groupId>
<artifactId>_AdminServicesEAR</artifactId>
<version>1.0.0-20080521.085352-1</version>
<type>ear</type>
</dependency>

I need to replace the value between <type> </type> tag at first occurance. i am using following sed command now but it is replacing the tag value globally

sed 's#<type>\([^<][^<]*\)</type>#<type>newvalue</type>#' application.xml > application.xml.new

Can anyone gelp me ....

Thanks and Regards,

By default sed operates on every line of a file. Your command line argument is telling sed to replace the first instance of <type>\([^<][^<]*\)</type> with <type>newvalue</type> in each line of the file.

Thnks for the reply ...
So is it possible for me to replace only the first occurance of <type> </type> value by using any other sed command ?