Template Method

TagScanner uses a template method to create a scanned node - it calls a matching tag scanner to do its job and produce a scanned node in a series of steps.

      public final Tag createScannedNode(
        Tag tag,
        String url,
        NodeReader reader,
        String currLine) throws ParserException {

        Tag thisTag = scan(tag,url,reader,currLine);
        thisTag.setThisScanner(this);
        thisTag.setAttributes(tag.getAttributes());
        return thisTag;
      }

    This is useful as the tag has some necessary associations established here - the association with the scanner that parsed it, and the attributes of the original tag that was processed to produce the specialized tag.

    --SomikRaha

    Last edited on Sunday, February 23, 2003  5:38:42 pm.