Examples of EndTag


Examples of org.htmlparser.tags.EndTag

        String currentLine)
    {
        // Insert end tag
        String newLine = insertEndTagBeforeNode(tag, currentLine);
        reader.changeLine(newLine);
        return new EndTag(
            new TagData(
                tag.elementBegin(),
                tag.elementBegin() + 3,
                tag.getTagName(),
                currentLine));
View Full Code Here

Examples of org.htmlparser.tags.EndTag

        Node node;
        MetaTag meta;
        String httpEquiv;
        String charset;
        boolean restart;
        EndTag end;
        IteratorImpl ret;

        remove_scanner = false;
        restart = false;
        ret = new IteratorImpl(reader, resourceLocn, feedback);
View Full Code Here

Examples of org.htmlparser.tags.EndTag

    {
        Node node;
        MetaTag meta;
        String httpEquiv;
        String charset;
        EndTag end;
        if (null != url_conn)
            try
            {
                if (null == scanners.get("-m"))
                {
                    addScanner(new MetaTagScanner("-m"));
                    remove_scanner = true;
                }

                /* pre-read up to </HEAD> looking for charset directive */
                while (null != (node = ret.peek()))
                {
                    if (node instanceof MetaTag)
                    { // check for charset on Content-Type
                        meta = (MetaTag) node;
                        httpEquiv = meta.getAttribute("HTTP-EQUIV");
                        if ("Content-Type".equalsIgnoreCase(httpEquiv))
                        {
                            charset = getCharset(meta.getAttribute("CONTENT"));
                            if (!charset.equalsIgnoreCase(character_set))
                            { // oops, different character set, restart
                                character_set = charset;
                                recreateReader();
                                ret =
                                    new IteratorImpl(
                                        reader,
                                        resourceLocn,
                                        feedback);
                            }
                            // once we see the Content-Type meta tag we're finished the pre-read
                            break;
                        }
                    }
                    else if (node instanceof EndTag)
                    {
                        end = (EndTag) node;
                        if (end.getTagName().equalsIgnoreCase("HEAD"))
                            // or, once we see the </HEAD> tag we're finished the pre-read
                            break;
                    }
                }
            }
View Full Code Here

Examples of org.htmlparser.tags.EndTag

    assertEquals("Tag Contents", "a", tag.getText());
    assertTrue("Node 1 should be a string node", node[1] instanceof StringNode);
    StringNode stringNode = (StringNode) node[1];
    assertEquals("StringNode Contents", "Revision", stringNode.getText());
    assertTrue("Node 2 should be a string node", node[2] instanceof EndTag);
    EndTag endTag = (EndTag) node[2];
    assertEquals("End Tag Contents", "a", endTag.getText());
  }
View Full Code Here

Examples of org.htmlparser.tags.EndTag

    assertEquals("Tag Contents", "font face=\"verdana,arial,helvetica\" SIZE=\"1\"", tag1.getText());
    assertTrue("Third contained node should be Tag", containedNodes[2] instanceof Tag);
    Tag tag2 = (Tag) containedNodes[2];
    assertEquals("Tag Contents", "b", tag2.getText());
    assertTrue("Fourth contained node should be HTMLEndTag", containedNodes[3] instanceof EndTag);
    EndTag endTag1 = (EndTag) containedNodes[3];
    assertEquals("Fourth Tag contents", "b", endTag1.getText());
    assertTrue("Fifth contained node should be HTMLEndTag", containedNodes[4] instanceof EndTag);
    EndTag endTag2 = (EndTag) containedNodes[4];
    assertEquals("Fifth Tag contents", "font", endTag2.getText());

  }
View Full Code Here

Examples of org.htmlparser.tags.EndTag

  /**
   * Bug reported by Gordon Deudney 2002-03-15 Nested JSP Tags were not
   * working
   */
  public void testNestedTags() throws ParserException {
    EndTag etag;
    String s = "input type=\"text\" value=\"<%=\"test\"%>\" name=\"text\"";
    String line = "<" + s + ">";
    createParser(line);
    parseAndAssertNodeCount(1);
    assertTrue("The node found should have been an Tag", node[0] instanceof Tag);
View Full Code Here

Examples of org.htmlparser.tags.EndTag

   * Test parseParameter method Created by Kaarle Kaila (august 2001) the tag
   * name is here G
   */
  public void testParseParameter3() throws ParserException {
    Tag tag;
    EndTag etag;
    StringNode snode;
    Node node = null;
    String lin1 = "<DIV class=\"userData\" id=\"oLayout\" name=\"oLayout\"></DIV>";
    createParser(lin1);
    NodeIterator en = parser.elements();
View Full Code Here

Examples of org.htmlparser.tags.EndTag

   * Test parseParameter method 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;
        assertEquals("paragraph contents", snode.getText(), "Paragraph");
      }
      if (en.hasMoreNodes()) {
        node = en.nextNode();
        etag = (EndTag) node;
        assertEquals("paragrapg endtag", etag.getText(), "p");
      }

    } catch (ClassCastException ce) {
      fail("Bad class element = " + node.getClass().getName());
    }
View Full Code Here

Examples of org.htmlparser.tags.EndTag

   * Test parseParameter method Created by Kaarle Kaila (august 2001) the tag
   * name is here G
   */
  public void testParseParameterG() throws ParserException {
    Tag tag;
    EndTag etag;
    StringNode snode;
    Node node = null;
    String lin1 = "<G href=\"http://www.iki.fi/kaila\" myParameter yourParameter=\"Kaila\">Kaarle's homepage</G><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("The tagname should be G", a, "G");
        assertEquals("Check the http address", href, "http://www.iki.fi/kaila");
        assertEquals("myValue is empty", myValue, "");
        assertEquals("The second parameter value", nice, "Kaila");
      }
      if (en.hasMoreNodes()) {
        node = en.nextNode();
        snode = (StringNode) node;
        assertEquals("The text of the element", snode.getText(), "Kaarle's homepage");
      }

      if (en.hasMoreNodes()) {
        node = en.nextNode();
        etag = (EndTag) node;
        assertEquals("Endtag is G", etag.getText(), "G");
      }
      // testing rest
      if (en.hasMoreNodes()) {
        node = en.nextNode();

        tag = (Tag) node;
        assertEquals("Follow up by p-tag", tag.getText(), "p");
      }
      if (en.hasMoreNodes()) {
        node = en.nextNode();
        snode = (StringNode) node;
        assertEquals("Verify the paragraph text", snode.getText(), "Paragraph");
      }
      if (en.hasMoreNodes()) {
        node = en.nextNode();
        etag = (EndTag) node;
        assertEquals("Still patragraph endtag", etag.getText(), "p");
      }

    } catch (ClassCastException ce) {
      fail("Bad class element = " + node.getClass().getName());
    }
View Full Code Here

Examples of org.htmlparser.tags.EndTag

   * name is here A (and should be eaten up by linkScanner) Tests elements
   * where = sign is surrounded by spaces
   */
  public void testParseParameterSpace() throws ParserException {
    Tag tag;
    EndTag etag;
    StringNode snode;
    Node node = null;
    String lin1 = "<A yourParameter = \"Kaarle\">Kaarle's homepage</A>";
    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);
        nice = (String) h.get("YOURPARAMETER");
        assertEquals("Link tag (A)", a, "A");
        assertEquals("yourParameter value", "Kaarle", 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("Still patragraph endtag", etag.getText(), "A");
        }
      }
      // testing rest

    } catch (ClassCastException ce) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.