RE: my dilemma -- hundreds of record types
- Posted by Kat <kat at kogeijin.com> Nov 15, 2002
- 362 views
On 15 Nov 2002, at 23:17, Bernie Ryan wrote: > > > irv at take.maxleft.com wrote: > > One way would be to find the desired tag, then read lines until you hit > > the > > next < > > Of course, this won't work if there are < 's imbedded in the data field. > > > > Irv: > > How about keeping a sequence list of tags. > constant tags = {<NAME>,<STATE>,..etc} > Then search for a line for first '<' > Then build another sequence of characters until see '>' or EOL. > if we see the EOL then process this line and start over again. > if we see '>' then you are formed sequence to find if it > exists in the tags sequence, if it does then its sequence > offset position could also be made to tell us how to process > the that tag line. if no tag is found then just process the > line as it belongs to the prior tag. But it won't. The lines are the fields of the "\n"-terminated "strings" of the database. This is why i used gets(), it breaks the file into the fields automagically for us, then anything in each field up to the first ">" is the tag for that field. Your logic also fails when processing tags in webpages containing javascript. And new tags cannot be added willy-nilly without changing the code to process it. Kat