* Created by Kaarle Kaila (august 2001)
* the tag name is here A (and should be eaten up by linkScanner)
*/
public void testParseParameterA() throws ParserException
{
Tag tag;
EndTag etag;
StringNode snode;
Node node = null;
String lin1 =
"<A href=\"http://www.iki.fi/kaila\" myParameter yourParameter=\"Kaarle Kaaila\">Kaarle's homepage</A><p>Paragraph</p>";
createParser(lin1);
NodeIterator en = parser.elements();
Hashtable h;
boolean testEnd = true; // test end of first part
String a, href, myPara, myValue, nice;
try
{
if (en.hasMoreNodes())
{
node = en.nextNode();
tag = (Tag) node;
h = tag.getAttributes();
a = (String) h.get(Tag.TAGNAME);
href = (String) h.get("HREF");
myValue = (String) h.get("MYPARAMETER");
nice = (String) h.get("YOURPARAMETER");
assertEquals("Link tag (A)", "A", a);
assertEquals("href value", "http://www.iki.fi/kaila", href);
assertEquals("myparameter value", "", myValue);
assertEquals("yourparameter value", "Kaarle Kaaila", nice);
}
if (!(node instanceof LinkTag))
{
// linkscanner has eaten up this piece
if (en.hasMoreNodes())
{
node = en.nextNode();
snode = (StringNode) node;
assertEquals(
"Value of element",
snode.getText(),
"Kaarle's homepage");
}
if (en.hasMoreNodes())
{
node = en.nextNode();
etag = (EndTag) node;
assertEquals("endtag of link", etag.getText(), "A");
}
}
// testing rest
if (en.hasMoreNodes())
{
node = en.nextNode();
tag = (Tag) node;
assertEquals("following paragraph begins", tag.getText(), "p");
}
if (en.hasMoreNodes())
{
node = en.nextNode();
snode = (StringNode) node;