Menu

Querying your parent whilst parsing?

Help
Colin
2006-03-07
2013-04-27
  • Colin

    Colin - 2006-03-07

    Hi All,

    I was wondering if its possible that when parser(file.html) is running can you query your parent for information?

    So if i start mParser.parse(null) this will trip all my custom tag handlers whilst it parses the html page.

    Some pages I have sections like:

    <DMW_REPEAT SQL="query string">
        <DMW_EXEC ....
        </DMW_EXEC>
    </DMW_REPEAT>

    So what I want to do is pull out the SQL query, go off and get its results, then apply the results to the DMW_EXEC tags.

    From what I can see the parser will know about the SQL attribute/value till after it finishes parsing the DMW_EXEC tags.

    Is it possible to find out the contents of DMW_REPEAT before parsing the DMW_EXEC tags?

    Thanks in advance,
    Colin.

     
    • Derrick Oswald

      Derrick Oswald - 2006-03-07

      I think to do this you need to override the scanner for your composite DWM_REPEAT tag. Specifically you need to do something in Tag scan(Tag tag, Lexer lexer, NodeList stack) and then call the superclass.

      So, your DWM_REPEAT tag prototype uses setThisScanner to use an overridden scanner, which subclasses CompositeScanner and overrides scan() to do the needful and then calls super.scan().

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.