Package org.htmlparser.tags

Examples of org.htmlparser.tags.CompositeTag


           
            // loop inside the tags of the same type
            NodeList links = getLinks (inputModified, tags[i], recursive);
            for (int j=0; j<links.size(); j++)
            {
                CompositeTag beginTag = (CompositeTag)links.elementAt(j);
                Tag endTag = beginTag.getEndTag();

                // positions of begin and end tags
                int beginTagBegin = beginTag.getStartPosition ();
                int endTagBegin = beginTag.getEndPosition ();
                int beginTagEnd = endTag.getStartPosition ();
                int endTagEnd = endTag.getEndPosition ();


                if (insideTag)
View Full Code Here


        // loop inside the tags of the same type
        NodeList links = getLinks (input, filter, recursive);
        for (int j=0; j<links.size(); j++)
        {
            CompositeTag beginTag = (CompositeTag)links.elementAt(j);
            Tag endTag = beginTag.getEndTag();

            // positions of begin and end tags
            int beginTagBegin = beginTag.getStartPosition ();
            int endTagBegin = beginTag.getEndPosition ();
            int beginTagEnd = endTag.getStartPosition ();
            int endTagEnd = endTag.getEndPosition ();

            if (insideTag)
            {
View Full Code Here

        // you have only the tag container and not the contained tags.
        if (!recursive)
        {
            for (int j=0; j<links.size(); j++)
            {
                CompositeTag jStartTag = (CompositeTag)links.elementAt(j);
                Tag jEndTag = jStartTag.getEndTag();
                int jStartTagBegin = jStartTag.getStartPosition ();
                int jEndTagEnd = jEndTag.getEndPosition ();
                for (int k=0; k<links.size(); k++)
                {
                    CompositeTag kStartTag = (CompositeTag)links.elementAt(k);
                    Tag kEndTag = kStartTag.getEndTag();
                    int kStartTagBegin = kStartTag.getStartPosition ();
                    int kEndTagEnd = kEndTag.getEndPosition ();
                    if ((k!=j) && (kStartTagBegin>jStartTagBegin) && (kEndTagEnd<jEndTagEnd))
                    {
                        links.remove(k);
                        k--;
View Full Code Here

        // you have only the tag container and not the contained tags.
        if (!recursive)
        {
            for (int j=0; j<links.size(); j++)
            {
                CompositeTag jStartTag = (CompositeTag)links.elementAt(j);
                Tag jEndTag = jStartTag.getEndTag();
                int jStartTagBegin = jStartTag.getStartPosition ();
                int jEndTagEnd = jEndTag.getEndPosition ();
                for (int k=0; k<links.size(); k++)
                {
                    CompositeTag kStartTag = (CompositeTag)links.elementAt(k);
                    Tag kEndTag = kStartTag.getEndTag();
                    int kStartTagBegin = kStartTag.getStartPosition ();
                    int kEndTagEnd = kEndTag.getEndPosition ();
                    if ((k!=j) && (kStartTagBegin>jStartTagBegin) && (kEndTagEnd<jEndTagEnd))
                    {
                        links.remove(k);
                        k--;
View Full Code Here

        Text [] stringNode =
            tableTag.digupStringNode("Hello World");

        assertEquals("number of string nodes",1,stringNode.length);
        assertNotNull("should have found string node",stringNode);
        CompositeTag parent = (CompositeTag)stringNode[0].getParent();
        int pos = parent.findPositionOf(stringNode[0]);
        /* a(b(),string("sdsd"),/b(),string("Hello World")) */
        /*   0   1              2    3 */
        assertEquals("position",3,pos);
    }
View Full Code Here

    assertStringEquals("first custom tag html", "<CUSTOM>something</CUSTOM>", customTag.toHtml());
    assertNull("second custom tag should have no parent", customTag.getParent());

    Node firstChild = customTag.childAt(0);
    assertType("firstChild", StringNode.class, firstChild);
    CompositeTag parent = firstChild.getParent();
    assertNotNull("first child parent should not be null", parent);
    assertSame("parent and custom tag should be the same", customTag, parent);

    EndTag endTag = (EndTag) node[2];
    assertStringEquals("first custom tag html", "</CUSTOM>", endTag.toHtml());
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);
    }
    return newTag;
  }
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.CompositeTag

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.