Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] About Parsing

From: rondon:andrade:uol at: 16-Jul-2001 6:18

Hi Rebolers!, I'm parsing a text file that was converted from M$word with bibliographic records such as: Id: 27698 Author: Kann, James Title: Crossroads of Life Abstract: This book talks about the hard ways of life. Source: State Public Library Holdings: AGE 12308082 I was parsing the file using this code: parse/all file [ some [ (id: "") (author: "") (title: "") (source: "") (abstract: "") (holdings: "") thru "Id: ^/^/^/" copy id to "^/" thru "Author: ^/^/^/" copy author to "^/" thru "Títle:" thru "^/^/^/" copy title to "^/" thru "Source:" thru "^/^/^/" copy source to "^/" thru "Abstract:" thru "^/^/^/" copy abstract to ^/ thru "Holdings:" thru "^/^/^/" copy holdings to ^/ (print "----------------") (count: count + 1) (print count) (print rejoin [ "Id:" id ]) (print rejoin [ "Title:" title ]) (print rejoin [ "Author:" author ]) (print rejoin [ "Source:" source ]) (print rejoin [ "Abstract:" abstract ]) (print rejoin [ "Holdings:" holdings ]) ] ] The problem is that when one of the labels such as "Abstract" is not present, it is not printing the rest of records present in the file. It just print "false". It does just the records that has all the labels, I mean "Id, Title, Author, Abstract, Holdings and Source", if breaks one rule, it will not print the rest of the record. How can fix that ? or Do I have to use one parse for each of the labels, creating a series variable for each label ? Thanks in advance. Rondon