Current location: Hot Scripts Forums » Programming Languages » Perl » strip out xml tags with regex


strip out xml tags with regex

Reply
  #1 (permalink)  
Old 03-16-06, 11:15 AM
ddolddolee82 ddolddolee82 is offline
Newbie Coder
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Question strip out xml tags with regex

I need to strip out xml tags from codes below and retrieve data between tags such as DSC_0003.jpg, Dragon at Choina town Gate, and so on with regular expression in perl.
I figured out how to get the data between tags if tags are on the same line but I am having trouble figuring out how to handle tags when they are on different lines such as comments tag in this case.
Any ideas???


<description>
<filename>DSC_0003.jpg</filename>
<title>Dragon at Chinatown Gate</title>
<location>San Francisco, California</location>
<comments>
A gloriously decorated gate marks the entry to Grant Avenue's
Chinatown. It was unveiled in 1970, and helped secure the street's
status as the neighborhood's center. Once you're past the gate,
you'll see elaborate 1920s streetlights sculpted to resemble golden
dragons lighting the way. Grant Avenue and Bush Street.
</comments>
</decription>

Last edited by ddolddolee82; 03-16-06 at 11:19 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-16-06, 01:58 PM
Millennium's Avatar
Millennium Millennium is offline
Wannabe Coder
 
Join Date: Nov 2003
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
let's see the code you have so far. Also, you probably want to use an XML aware module like XML::Simple to parse out your xml files, but I have never used that module so can't help with how to use it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-16-06, 04:50 PM
ddolddolee82 ddolddolee82 is offline
Newbie Coder
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb

Sorry, I am on linux now and fomr some reason I can not copy and paste codes from emacs to Mozilla brower.
I was told by someone that I should use m modifier with regular expression.
Let me look for some examples of using m modifier.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The perfect PHP comments strip regex? Subway PHP 0 01-05-06 08:40 AM
java codes to strip html tags y2j150 JavaScript 1 08-05-05 04:44 PM
How can I strip certain tags between certan points? Keith PHP 10 03-25-05 10:59 AM
javascripting and XML Christoff JavaScript 1 06-23-04 06:44 AM
freeware code to strip HTML tags ? xgab Perl 5 04-19-04 08:31 PM


All times are GMT -5. The time now is 06:36 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.