[antlr-interest] How to get a recursive/tree content structure of a html using html.g ?

WU Zilong zilong.wu at gmail.com
Tue Dec 6 08:26:26 PST 2005


Hi all,

    I'm a newbie and meet a problem when using the html.g in the C++
examples. I wish to get the structure of the input html. Such as I get
a node named <html> </html> as root, which has sub-node <head></head>
and <body></body>, and also <head></head> and <body></body> node have
their own sub-nodes. It's something like a tree strucutre. How could I
do?
   Maybe I need to add AST support? I tried by adding buildAST=true
to options field. And in the sample I got the <html> </html> tag with
parser.getAST(). My question is that why the child number of the ast
(derived by parser.getAST()) is 0? Of course there are many other tags
such as <head></head> and <body></body> under <html></html>. How can I
get the sub nodes?

   Thanks

   Andy


More information about the antlr-interest mailing list