My apologies if this is misdirected, but I could use some basic help with
lex. I'm writing a filter for a tagged file and have done all of the
basic routines (i.e., the routines my *basic* skills will cover). Some of
the tagging I'm trying to cover looks like the following:
<doc name="Opera" author="Anselmus">
but sometimes they're like:
<doc author="Anselmus">
and sometimes like:
<doc name="Opera">
They are always one of the three, and the contents of the quotes are of
variable length, often containing spaces. I'd like to render them as:
Name: Opera
Author: Anselmus
(or the corresponding versions with only one of the elements). There's
another variation on this theme, where the hierarchical tag scheme "<divN"
is used, so that I encounter
<div1 name="Opera" author="Anselmus">
as well as
<div2 name="Opera" author="Anselmus">
and so on, through div4. My first and most immediate concern is to get a
lex routine that will take care of each instance (e.g,. a <doc tag that
has any one of the three configurations -- both author and name, or either
author or name), but an ideal solution would be to have something that did
a <doc or any <divN as well. I'd be much obliged if someone would show me
the light on this. Replying to me personally would be swell.
John Price-Wilkin