sed xml challenge

I have a web xml file that looks like this:

<allinfo>
    <info>
          <a>Name1<\a>
          <b>address1<\b>
           <c>phone1<c>
    <\info>
    <info>
          <a>Name2<\a>
          <b>address2<\b>
          <c>phone2<c>
<\info>
<\allinfo>

I want to use sed to extract all the informations.
for instance, the output for the xml above would be:

Name: Name1
address: address1
phone: phone1

Name: Name2
address: address2
phone: phone2

I thought of few ways of doing it, but right now I'm stuck on the sed code.

Any help would be great

Thank you

Show us what you have.

The website file you presented here was not valid or well-formed xml document

The following is a well-formed and valid xml document:

<allinfo>
    <info>
          <a>Name1</a>
          <b>address1</b>
          <c>phone1</c>
    </info>
    <info>
          <a>Name2</a>
          <b>address2</b>
          <c>phone2</c>
    </info>
</allinfo>

The best way to transform an XML document to use an XSLT processor. xsltproc is such a processor and is very common on UNIX and Linus systems.

Here is a stylesheet which will transform the XML document into the output you want.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:<xsl:output method="text" />

<xsl:template match="/allinfo/info">
Name: <xsl:value-of select="a"/>
Address: <xsl:value-of select="b"/>
Phone: <xsl:value-of select="c"/>
</xsl:template>

</xsl:stylesheet>

xsltproc file.xsl file.xml produces the following output:

Name: Name1
Address: address1
Phone: phone1

Name: Name2
Address: address2
Phone: phone2