Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Striping text out of a xml file

Status
Not open for further replies.

IMAUser

Technical User
May 28, 2003
121
CH
<?xml version="1.0"?>
<data>
<header>
<name>Red Obligation Download 2</name>
<version>1.1a</version>
<date>2004-08-03</date>
</header>

<bond>
<name>NBR-Inc 0 05Feb21</name>
<issuer>
<name>Nabors Industries, Inc.</name>
<red>68BEBEAA0</red>
<updated>2004-03-31</updated>
</issuer>
<type>Bond</type>
<isconvert>true</isconvert>
<isperp>false</isperp>
<coupontype>Fixed</coupontype>
<tier>SNRFOR</tier>
<ccy>USD</ccy>
<maturity>2021-02-05</maturity>
<coupon>0</coupon>
<originalisin>US629568AF37</originalisin>
<isin>US629568AF37</isin>
<cusip>629568AF3</cusip>
<updated>2004-03-31</updated>
</bond>
<bond>
<name>FORTIS-FinNV 4.625 07Apr09</name>
<issuerfromprospectus>Fortis Finance N.V.</issuerfromprospectus>
<guarantor>
<name>Fortis (B) S.A./N.V.; Fortis (NL) N.V.</name>
<red>37DEKHAA6</red>
<updated>2004-02-20</updated>
</guarantor>
<guarantor>
<name>Fortis (B) S.A./N.V.; Fortis (NL) N.V.</name>
<red>37DEKKAA9</red>
<updated>2004-02-16</updated>
</guarantor>
<type>Bond</type>
<isconvert>false</isconvert>
<isperp>false</isperp>
<coupontype>Fixed</coupontype>
<tier>SNRFOR</tier>
<ccy>EUR</ccy>
<maturity>2009-04-07</maturity>
<coupon>0.04625</coupon>
<originalisin>XS0096324925</originalisin>
<isin>XS0096324925</isin>
<cusip>N3340HAE0</cusip>
<updated>2004-02-20</updated>
</bond>
<bond>
<name>WOWAU Frn 20Aug07</name>
<issuer>
<name>Woolworths Limited</name>
<red>9H88GGAA4</red>
<updated>2004-02-13</updated>
</issuer>
<type>Bond</type>
<isconvert>false</isconvert>
<isperp>false</isperp>
<coupontype>Float</coupontype>
<tier>SNRFOR</tier>
<ccy>AUD</ccy>
<maturity>2007-08-20</maturity>
<coupon>0</coupon>
<originalisin>AU000WW20022</originalisin>
<isin>AU000WW20022</isin>
<updated>2004-02-13</updated>
</bond>

Hi,
Thats an example of an XML file I have. I need to strip all the tags and get the data in a comma sererated file. I have done a simple xml extraction, but in this file as you can see the tags may or may not exist.

Like on the first and third instances the tag <issuer> comprises of <name>, <red> and <updated> but on the second instance there is <IssuerFromPropectus> and <guarantor>. And here Gurantor has nested tags.

So you see the tags are not fixed, and the numbe of tags on each instance can vary, but on the csv file I would like the same number of columns for every record.
So if a tag does not exist I will still output the de-limiter.

Any help appreciated,

Thanks
 
Thanks LKBrwnDBA,

I'll look up the sites.
 
PS: Just being sarcastic, your requirement is equivalent of coding an XML parser (which there are too many in the market today)

Good luck!



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top