i want to get the text from the folleing text:<body>
<ul>
<li><font face="Verdana, Arial, Helvetica, sans-serif"><a href="http://www.tamaracchamber.org/"><font size="2" face="Verdana,Arial,Helvetica"> Tamarac Chamber of Commerce </font></a></font>
</li>
</ul>
</body>
i established the font tag
public class FontTag extends CompositeTag
{
private static final String[] mIds = new String[] {"FONT"};
private static final String[] mEnders = new String[] {"FONT"};
private static final String[] mEndTagEnders = new String[] {"BODY","HTML"};
public String[] getIds () { return (mIds); }
}
and
PrototypicalNodeFactory factory = (PrototypicalNodeFactory)t_parser.getNodeFactory();
factory.registerTag(new FontTag());
but i can' t get the text "Tamarac Chamber of Commerce ".
i get the text "null".
why?
please help me!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have two font tags, one embedded within the other.
Are you looking at only the outermost one?
If the outermost font tag is font, then:
font.getChildren().elementAt (1);
should get you the inner one (maybe it's not the second cilld).
Then
font.getChildren().elementAt (0);
should get you the text node.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I find there exist some problem in <a> tag.
The reason i can't get the text in the inner tag<font > is that i can't get the children in <a> tag
LinkTag.getChildren() will return null.
how i get the children of LinkTag?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It might have run into something that caused a virtual end tag insertion, but if we are talking about the previous HTML you posted, I see nothing that would cause LinkTag to end itself prematurely. Is that all the HTML or did you reduce it a bit for posting? A virtual end tag can be identified by the start and end positions being the same.
A LinkTag will be ended by:
enders: "A", "P", "DIV", "TD", "TR", "FORM", "LI" endtagenders: "/P", "/DIV", "/TD", "/TR", "/FORM", "/LI", "/BODY", "/HTML"
Did you redefine LinkTag to have more Enders or EndTagEnders?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i want to get the text from the folleing text:<body>
<ul>
<li><font face="Verdana, Arial, Helvetica, sans-serif"><a href="http://www.tamaracchamber.org/"><font size="2" face="Verdana,Arial,Helvetica"> Tamarac Chamber of Commerce </font></a></font>
</li>
</ul>
</body>
i established the font tag
public class FontTag extends CompositeTag
{
private static final String[] mIds = new String[] {"FONT"};
private static final String[] mEnders = new String[] {"FONT"};
private static final String[] mEndTagEnders = new String[] {"BODY","HTML"};
public String[] getIds () { return (mIds); }
}
and
PrototypicalNodeFactory factory = (PrototypicalNodeFactory)t_parser.getNodeFactory();
factory.registerTag(new FontTag());
but i can' t get the text "Tamarac Chamber of Commerce ".
i get the text "null".
why?
please help me!
You have two font tags, one embedded within the other.
Are you looking at only the outermost one?
If the outermost font tag is font, then:
font.getChildren().elementAt (1);
should get you the inner one (maybe it's not the second cilld).
Then
font.getChildren().elementAt (0);
should get you the text node.
I find there exist some problem in <a> tag.
The reason i can't get the text in the inner tag<font > is that i can't get the children in <a> tag
LinkTag.getChildren() will return null.
how i get the children of LinkTag?
It might have run into something that caused a virtual end tag insertion, but if we are talking about the previous HTML you posted, I see nothing that would cause LinkTag to end itself prematurely. Is that all the HTML or did you reduce it a bit for posting? A virtual end tag can be identified by the start and end positions being the same.
A LinkTag will be ended by:
enders: "A", "P", "DIV", "TD", "TR", "FORM", "LI" endtagenders: "/P", "/DIV", "/TD", "/TR", "/FORM", "/LI", "/BODY", "/HTML"
Did you redefine LinkTag to have more Enders or EndTagEnders?