[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Extracting email addresses from an XML document (Hello BlueDevilFan!)

Posted on 2005-05-12
3
Medium Priority
?
232 Views
Last Modified: 2010-04-08
Hello all:

I am trying to extract the email addresses from an xml file.  Here is what it looks like:

<?xml version="1.0" encoding="utf-8" ?>
<contents>
    <addr>
      <email>ccooper@mshdirect.com</email><name>Chris Cooper</name><at>SMTP</at><source>3</source><ld>481272848</ld><hd>29606945</hd><ldlu>481272848</ldlu><hdlu>29606945</hdlu><tu>1</tu>
    </addr>
    <addr>
      <email>angus_laverty@labour.ie</email><name>Angus Laverty</name><at>SMTP</at><source>1</source><ld>2490327632</ld><hd>29601702</hd><ldlu>3738936032</ldlu><hdlu>29681508</hdlu><tu>3</tu>
    </addr>
    <addr>
      <email>olja.begg@medas.co.uk</email><name>Olja.Begg@medas.co.uk</name><at>SMTP</at><source>1</source><ld>2487223168</ld><hd>29601702</hd><ldlu>2487223168</ldlu><hdlu>29601702</hdlu><tu>0</tu>
    </addr>
    <addr>
      <email>bannonm@bellsouth.net</email><name>Maura Bannon</name><at>SMTP</at><source>3</source><ld>1447033616</ld><hd>29611749</hd><ldlu>1447133760</ldlu><hdlu>29611749</hdlu><tu>1</tu>
    </addr>
    <addr>
</contents>

The file is 1.2 Megs big.  I am looking at just pulling what is between the <email> and </email> tags and storing them in a simple .txt file, one address per line.

Could someone please help me out with this?

Indebted to you.

--D.
0
Comment
Question by:driven13
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
softplus earned 2000 total points
ID: 13991689
Are these real addresses? Welcome to spambot2000, yum yum :)

Add this to your xml file (right below your first line):
<?xml-stylesheet type="text/xsl" href="data.xsl" ?>

then make the data.xsl (in the same folder as your xml file):
<?xml version="1.0" encoding="ISO-8859-1"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
  <body >
    <xsl:for-each select="contents/addr">
        <p><xsl:value-of select="email"/></p>
    </xsl:for-each>
  </body>
</html>

Now open the xml file in IE -- presto! List of emails! :)
0
 
LVL 13

Expert Comment

by:softplus
ID: 13991697
If you want to save it, just copy+paste into a notepad file.
0
 

Author Comment

by:driven13
ID: 13992280
Thank you softplus!!

That worked perfectly.

--D.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below errors for MS Exchange Server 2016 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
MS Outlook undoubtedly is the most widely used email client.Its user-friendliness, cost effectiveness, and availability with Microsoft Office Suite make it the most popular email application.  Its compatibility with Microsoft applications like Exch…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question