Package org.htmlparser.tags.data

Examples of org.htmlparser.tags.data.TagData


        "ftp://www.someurl.com", "", "", false, false));
    assertTrue("This is an ftp link", linkTag.isFTPLink());
  }

  public void testTypeJavaScript() throws ParserException {
    LinkTag linkTag = new LinkTag(new TagData(0, 0, "", ""), new CompositeTagData(null, null, null), new LinkData(
        "javascript://www.someurl.com", "", "", false, true));
    assertTrue("This is a javascript link", linkTag.isJavascriptLink());
  }
View Full Code Here


        "javascript://www.someurl.com", "", "", false, true));
    assertTrue("This is a javascript link", linkTag.isJavascriptLink());
  }

  public void testTypeHttpLink() throws ParserException {
    LinkTag linkTag = new LinkTag(new TagData(0, 0, "", ""), new CompositeTagData(null, null, null), new LinkData(
        "http://www.someurl.com", "", "", false, false));
    assertTrue("This is a http link : " + linkTag.getLink(), linkTag.isHTTPLink());
    linkTag = new LinkTag(new TagData(0, 0, "", ""), new CompositeTagData(null, null, null), new LinkData(
        "somePage.html", "", "", false, false));
    assertTrue("This relative link is alsp a http link : " + linkTag.getLink(), linkTag.isHTTPLink());
    linkTag = new LinkTag(new TagData(0, 0, "", ""), new CompositeTagData(null, null, null), new LinkData(
        "ftp://somePage.html", "", "", false, false));
    assertTrue("This is not a http link : " + linkTag.getLink(), !linkTag.isHTTPLink());
  }
View Full Code Here

        "ftp://somePage.html", "", "", false, false));
    assertTrue("This is not a http link : " + linkTag.getLink(), !linkTag.isHTTPLink());
  }

  public void testTypeHttpLikeLink() throws ParserException {
    LinkTag linkTag = new LinkTag(new TagData(0, 0, "", ""), new CompositeTagData(null, null, null), new LinkData(
        "http://", "", "", false, false));
    assertTrue("This is a http link", linkTag.isHTTPLikeLink());
    LinkTag linkTag2 = new LinkTag(new TagData(0, 0, "", ""), new CompositeTagData(null, null, null), new LinkData(
        "https://www.someurl.com", "", "", false, false));
    assertTrue("This is a https link", linkTag2.isHTTPLikeLink());
  }
View Full Code Here

  /**
   * This is the reproduction of a bug which causes a null pointer exception
   */
  public void testExtractImageLocnInvertedCommasBug() throws ParserException {
    Tag tag = new Tag(
        new TagData(
            0,
            0,
            "img width=638 height=53 border=0 usemap=\"#m\" src=http://us.a1.yimg.com/us.yimg.com/i/ww/m5v5.gif alt=Yahoo",
            ""));
    String link = "img width=638 height=53 border=0 usemap=\"#m\" src=http://us.a1.yimg.com/us.yimg.com/i/ww/m5v5.gif alt=Yahoo";
View Full Code Here

  public HTMLTagParserTest(String name) {
    super(name);
  }

  public void testCorrectTag() {
    Tag tag = new Tag(new TagData(0, 20,
        "font face=\"Arial,\"helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\"",
        "<font face=\"Arial,\"helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\">"));
    tagParser.correctTag(tag);
    assertStringEquals("Corrected Tag",
        "font face=\"Arial,helvetica,\" sans-serif=\"sans-serif\" size=\"2\" color=\"#FFFFFF\"", tag.getText());
View Full Code Here

    if (state == ENDTAG_BEGIN_PARSING_STATE) {
      tagEnd = i;
      state = ENDTAG_FINISHED_PARSING_STATE;
    }
    if (state == ENDTAG_FINISHED_PARSING_STATE)
      return new EndTag(new TagData(tagBegin, tagEnd, tagContents.toString(), input));
    else
      return null;
  }
View Full Code Here

    int state = TAG_BEFORE_PARSING_STATE;
    int i = position;
    char ch;
    char[] ignorechar = new char[1];
    // holds the character we're looking for when in TAG_IGNORE_DATA_STATE
    Tag tag = new Tag(new TagData(position, 0, reader.getLastLineNumber(), 0, "", input, "", false));

    Bool encounteredQuery = new Bool(false);
    while (i < tag.getTagLine().length() && state != TAG_FINISHED_PARSING_STATE && state != TAG_ILLEGAL_STATE) {
      ch = tag.getTagLine().charAt(i);
      state = automataInput(encounteredQuery, i, state, ch, tag, i, ignorechar);
View Full Code Here

  private void createCorrectionEndTagBefore(int pos) {
    String endTagName = tag.getTagName();
    int endTagBegin = pos;
    int endTagEnd = endTagBegin + endTagName.length() + 2;
    endTag = new EndTag(new TagData(endTagBegin, endTagEnd, endTagName, currLine));
  }
View Full Code Here

    String endTagName = tag.getTagName();
    int endTagBegin = possibleEndTagCauser.elementBegin();
    int endTagEnd = endTagBegin + endTagName.length() + 2;
    possibleEndTagCauser.setTagBegin(endTagEnd + 1);
    reader.addNextParsedNode(possibleEndTagCauser);
    endTag = new EndTag(new TagData(endTagBegin, endTagEnd, endTagName, currLine));
  }
View Full Code Here

    newLine.append(currLine.substring(endTagBegin, currLine.length()));
    return newLine;
  }

  private Tag createTag() throws ParserException {
    CompositeTag newTag = (CompositeTag) scanner.createTag(new TagData(tag.elementBegin(), endTag.elementEnd(),
        startingLineNumber, endingLineNumber, tag.getText(), currLine, url, tag.isEmptyXmlTag()),
        new CompositeTagData(tag, endTag, nodeList));
    for (int i = 0; i < newTag.getChildCount(); i++) {
      Node child = newTag.childAt(i);
      child.setParent(newTag);
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.data.TagData

Copyright © 2018 www.massapicom. 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.