Re: htdig: (Not) translating entities


Andrew Scherpbier (andrews@contigo.com)
Tue, 12 Jan 1999 10:22:15 -0800


Gilles Detillieux wrote:
>
> Hi. I have a couple questions/comments about Marjolein's patch:
>
>

[snip]

> > ! //
> > //mk19990111
> > ! // Do NOT translate entities for '<' and '>' since they can
> > //mk19990111
> > ! // occur in code samples that might end up in an excerpt.
> > //mk19990111
> > ! //
> > //mk19990111
> > ! if (entity.compare(new String("lt")) == 0 ||
> > //mk19990111
> > ! entity.compare(new String("#60")) == 0 ||
> > //mk19990111
> > ! entity.compare(new String("gt")) == 0 ||
> > //mk19990111
> > ! entity.compare(new String("#62")) == 0 )
> > //mk19990111
> > ! {
> > //mk19990111
> > ! entityStart = orig + 1;
> > //mk19990111
> > ! return '&';
> > //mk19990111
> > ! }
> > //mk19990111
> > ! }
> > //mk19990111
> > !
> > if (entity.length() >= 10)
> > {
> > //
>
> Correct me if I'm wrong, but won't all these new String("blah") constructs
> lead to major memory leaks in htdig? I think a better way of comparing the
> entity String to a char * would be:
> if (strcmp(entity.get(), "blah") == 0)

Probably. For efficient string matching, the StringMatch class should be
used. It matches strings in parallel.
If the statemachine compiling of StringMatch takes too long (but it only needs
to be done once...), a simple 6 state statemachine can do the matching in the
above code.

-- 
Andrew Scherpbier <andrews@contigo.com>
Contigo Software <http://www.contigo.com/>
----------------------------------------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig-request@sdsu.edu containing the single word "unsubscribe" in
the body of the message.



This archive was generated by hypermail 2.0b3 on Wed Jan 13 1999 - 09:13:06 PST