[Htmlparser-user] Elements and text nodes
Brought to you by:
derrickoswald
From: Bastian H. <ho...@fm...> - 2006-04-17 10:21:28
|
Hello, given this text string "<html><body><a href="xy">test</a></body></html>" HTMLParser creates this nodelist: Tag (0[0,0],6[0,6]): html Tag (6[0,6],12[0,12]): body Tag (12[0,12],25[0,25]): a href="xy" Txt (25[0,25],29[0,29]): test End (29[0,29],33[0,33]): /a End (33[0,33],40[0,40]): /body End (40[0,40],47[0,47]): /html So, the text "test" is child element of the tag node for the element <A>. I like this behaviour and I think thats correct way to do that. But: from this text string "<html><body><code>test</code></body></html>" the parser creates the following node list: Tag (0[0,0],6[0,6]): html Tag (6[0,6],12[0,12]): body Tag (12[0,12],18[0,18]): code Txt (18[0,18],22[0,22]): test End (22[0,22],29[0,29]): /code End (29[0,29],36[0,36]): /body End (36[0,36],43[0,43]): /html so, the text "test" is not a child element of the tag <code>. Why does this happen? Is it a bug or feature? Thank you for your help, greetings Bastian Hoesch |