Package org.htmlparser.nodes

Examples of org.htmlparser.nodes.TextNode


      nodes = parser.extractAllNodesThatMatch(nfilter);
    } catch (ParserException e) {
      return html;
    }
    for(int i=0;i<nodes.size();i++){
      TextNode node = (TextNode)nodes.elementAt(i);
      text.append(node.getText());
    }
    return StringUtils.remove(text.toString(),"&nbsp;");
  }
View Full Code Here


          //System.out.println("TAG: " + '<'+tag.getText()+'>');
        }
        else if(node instanceof TextNode){
          int space = max_count - prvContent.length();
          if(space > 10){
            TextNode text = (TextNode)node;
            if(text.getText().length() < 10)
              prvContent.append(text.getText());
            else
              prvContent.append(StringUtils.abbreviate(text.getText(), max_count - prvContent.length()));
            //System.out.println("TEXT: " + text.getText());
          }
        }
      }
      return prvContent.toString();
View Full Code Here

     * @param end The ending positiong of the string.
     * @return The created Text node.
     */
    public Text createStringNode (Page page,  int start, int end)
    {
        return (new TextNode (page, start, end));
    }
View Full Code Here

        Node node;
        Tag tag;
        String paramName;
        String paramValue;
        Vector attributes;
        TextNode string;
       
        kids = getChildren ();
        if (null == kids)
            kids = new NodeList ();
        else
            // erase objectParams from kids
            for (int i = 0; i < kids.size (); )
            {
                node = kids.elementAt (i);
                if (node instanceof Tag)
                    if (((Tag)node).getTagName ().equals ("PARAM"))
                    {
                        kids.remove (i);
                        // remove whitespace too
                        if (i < kids.size ())
                        {
                            node = kids.elementAt (i);
                            if (node instanceof TextNode)
                            {
                                string = (TextNode)node;
                                if (0 == string.getText ().trim ().length ())
                                    kids.remove (i);
                            }
                        }
                    }
                    else
View Full Code Here

     * @param end The ending positiong of the string.
     * @return The created Text node.
     */
    public Text createStringNode (Page page,  int start, int end)
    {
        return (new TextNode (page, start, end));
    }
View Full Code Here

     * otherwise create a new factory with all tags registered.
     */
    public PrototypicalNodeFactory (boolean empty)
    {
        clear ();
        mText = new TextNode (null, 0, 0);
        mRemark = new RemarkNode (null, 0, 0);
        mTag = new TagNode (null, 0, 0, null);
        if (!empty)
            registerTags ();
    }
View Full Code Here

     * @see #getTextPrototype
     */
    public void setTextPrototype (Text text)
    {
        if (null == text)
            mText = new TextNode (null, 0, 0);
        else
            mText = text;
    }
View Full Code Here

            ret.setStartPosition (start);
            ret.setEndPosition (end);
        }
        catch (CloneNotSupportedException cnse)
        {
            ret = new TextNode (page, start, end);
        }

        return (ret);
    }
View Full Code Here

        Node node;
        Tag tag;
        String paramName;
        String paramValue;
        Vector attributes;
        TextNode string;
       
        kids = getChildren ();
        if (null == kids)
            kids = new NodeList ();
        else
            // erase objectParams from kids
            for (int i = 0; i < kids.size (); )
            {
                node = kids.elementAt (i);
                if (node instanceof Tag)
                    if (((Tag)node).getTagName ().equals ("PARAM"))
                    {
                        kids.remove (i);
                        // remove whitespace too
                        if (i < kids.size ())
                        {
                            node = kids.elementAt (i);
                            if (node instanceof TextNode)
                            {
                                string = (TextNode)node;
                                if (0 == string.getText ().trim ().length ())
                                    kids.remove (i);
                            }
                        }
                    }
                    else
View Full Code Here

    Cell cell = row.getColumn(colIndex);
    if (exceptionResult.hasMessage()) {
      cell.setExceptionResult(exceptionResult);
    } else {
      Row childRow = makeChildRow(row,
              new TextNode("<pre>" + HtmlUtil.escapeHTML(exceptionResult.getException()) + "</pre>"),
              "exception");
      insertRowAfter(row, childRow);
      row.setExecutionResult(exceptionResult.getExecutionResult());
    }
  }
View Full Code Here

TOP

Related Classes of org.htmlparser.nodes.TextNode

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.