Examples of TagNode


Examples of org.htmlcleaner.TagNode

      for( int i=0 ; i<lElements.size() ; i++ )
      {
        try
        {
          HtmlCleaner cleaner = new HtmlCleaner();
          TagNode rootNode = cleaner.clean(new URL(url));
          TagNode tagElements[] = rootNode.getElementsByName( lElements.get(i).getTag(), true );
          for( int j=0 ; j<tagElements.length ; j++ )
            if( lElements.get(i).getClas().equalsIgnoreCase("*") || tagElements[j].getAttributeByName("class").equals(lElements.get(i).getClas()) )
              lElements.get(i).add( tagElements[j].getText().toString() );
        }
        catch( Exception e )
View Full Code Here

Examples of org.htmlparser.nodes.TagNode

      NodeList nodes = parser.extractAllNodesThatMatch(nfilter);
      Node node = null;
      for(int i=0;i<nodes.size();i++){
        if(prvContent.length() >= max_count){
          if(node instanceof TagNode){
            TagNode tmp_node = (TagNode)node;
            boolean isEnd = tmp_node.isEndTag();
            if(!isEnd){
              prvContent.setLength(prvContent.length()-tmp_node.getText().length()-2);
            }
          }
          //��������δ�رյı�ǩ
          Node parent = node;
          //System.out.println("current node is . "+parent.getText());
          do{
            parent = parent.getParent()
            //System.out.println("parent = "+parent);         
            if(parent==null) break;
            if(!(parent instanceof TagNode)) continue;
            //System.out.println("Parent node is no ended. "+parent.getText());
            prvContent.append(((TagNode)parent).getEndTag().toHtml());
          }while(true);
          break;
        }
        node = nodes.elementAt(i);
        if(node instanceof TagNode){
          TagNode tag = (TagNode)node;
          prvContent.append('<');
          prvContent.append(tag.getText());
          prvContent.append('>');
          //System.out.println("TAG: " + '<'+tag.getText()+'>');
        }
        else if(node instanceof TextNode){
          int space = max_count - prvContent.length();
View Full Code Here

Examples of org.htmlparser.nodes.TagNode

                                                           Perl5Substitution.INTERPOLATE_ALL),
                                     sTag, Util.SUBSTITUTE_ALL));

    } else if (oNode instanceof TagNode && oNode.toHtml().toLowerCase().startsWith("<link")) {

      TagNode oLnkNode = (TagNode) oNode;
      String sSrc = oLnkNode.getAttribute("href");
    String sType = oLnkNode.getAttribute("type");
    if (sType==null) sType="text/css";
   
    if (sType.equalsIgnoreCase("text/css")) {

      oBuffer.append("<style type=\"text/css\">\n<!--\n");
      try {
        oBuffer.append(oFS.readfile(sSrc));
      } catch (com.enterprisedt.net.ftp.FTPException ftpe) {
        throw new IOException(sSrc, ftpe);
      }
      oBuffer.append("\n-->\n</style>\n");

    } else {

        try {
          oPattern = oCompiler.compile(sSrc);
        } catch (MalformedPatternException neverthrown) {
          if (DebugFile.trace) DebugFile.writeln("MalformedPatternException "+sSrc);
          oPattern=null;
        }

        iSlash = sSrc.lastIndexOf('/');
        if (iSlash>=0) {
          while (sSrc.charAt(iSlash)=='/') { if (++iSlash==sSrc.length()) break; }
          sCid = sSrc.substring(iSlash);
        } else {
          sCid = sSrc;
        } // fi

        if (!oDocumentImages.containsKey(sCid)) {

         if (DebugFile.trace) DebugFile.writeln("HashMap.put(" + sSrc + "," + sCid + ")");

          oDocumentImages.put(sCid, sSrc);
        } // fi (oDocumentImages.containsKey(sCid))

      sTag = oLnkNode.toHtml(true);

      if (DebugFile.trace) DebugFile.writeln("Util.substitute([Perl5Matcher], "+oPattern.getPattern()+", new Perl5Substitution(cid:"+oDocumentImages.get(sCid)+", Perl5Substitution.INTERPOLATE_ALL)"+", "+sTag+ ", Util.SUBSTITUTE_ALL)");

      oBuffer.append(Util.substitute(oMatcher, oPattern,
                                     new Perl5Substitution("cid:"+sCid,
View Full Code Here

Examples of org.htmlparser.nodes.TagNode

                    // moment this splits a tag into two causing a
                    // failure later
                    continue;

                } else if (node instanceof TagNode && ((TagNode) node).getTagName().startsWith("SWF:")) {
                    final TagNode tagNode = (TagNode) node;
                    final String tagName = tagNode.getTagName().toUpperCase();
                    LOG.debug(tagName);

                    // TODO remove context & request from Attributes -- the tags
                    // will be re-used across
                    // requests
                    final Attributes attributes = new Attributes(tagNode, context);
                    int type = 0;
                    if (tagNode.isEndTag()) {
                        type = SwfTag.END;
                    } else {
                        type = tagNode.isEmptyXmlTag() ? SwfTag.EMPTY : SwfTag.START;
                    }
                    testForProcessorForTag(lexer, tagName);
                    lineNumbers = lineNumbering(node);
                    final SwfTag tag = new SwfTag(tagName, attributes, type, lineNumbers, loadFile.getCanonicalPath());
                    tags.push(tag);

                    if (tagName.equals("SWF:IMPORT")) {
                        if (!tagNode.isEmptyXmlTag()) {
                            throw new ScimpiException("Import tag must be empty");
                        }
                        String importFile = tagNode.getAttribute("file");
                        if (context.isDebug()) {
                            context.getWriter().println("<!-- " + "import file " + importFile + " -->");
                        }
                        importFile = context.replaceVariables(importFile);
                        parseHtmlFile(loadPath, importFile, context, tags, tagsForPreviousTemplate);
                    }

                    if (tagName.equals("SWF:TEMPLATE")) {
                        if (!tagNode.isEmptyXmlTag()) {
                            throw new ScimpiException("Template tag must be empty");
                        }
                        if (template != null) {
                            throw new ScimpiException("Template tag can only be used once within a file");
                        }
                        template = tagNode.getAttribute("file");
                        template = context.replaceVariables(template);
                        if (context.isDebug()) {
                            context.getWriter().println("<!-- " + "apply template " + template + " -->");
                        }
                        tags = new Stack<Snippet>();
                    }

                    if (tagName.equals("SWF:CONTENT")) {
                        if (!tagNode.isEmptyXmlTag()) {
                            throw new ScimpiException("Content tag must be empty");
                        }
                        if (context.isDebug()) {
                            context.getWriter().println("<!-- " + "insert content into template -->");
                        }
View Full Code Here

Examples of org.outerj.daisy.diff.html.dom.TagNode

  }

  private void addRecursive(TagNode tree) {
    for (Node child : tree) {
      if (child instanceof TagNode) {
        TagNode tagnode = (TagNode) child;
        addRecursive(tagnode);
      } else if (child instanceof TextNode) {
        TextNode textnode = (TextNode) child;
        leafs.add(textnode);
      }
View Full Code Here

Examples of ru.org.linux.util.bbcode.nodes.TagNode

    if (!node.isParameter()) {
      node.setParameter("");
    } else {
      node.setParameter(node.getParameter().trim());
    }
    TagNode tagNode = (TagNode)node;
    RootNode rootNode = tagNode.getRootNode();
    if (rootNode.isComment()) { // коментарий, просто содержимое
      return node.renderChildrenXHtml();
    } else if (rootNode.isTopicMaximized()) { // топик не свернутым cut, содежимое в div
      return "<div id=\"cut" + Integer.toString(rootNode.getCutCount()) + "\">" + node.renderChildrenXHtml() + "</div>";
    } else if(rootNode.isTopicMinimized()) { // топик со свернутым cut, вместо содержимого ссылка
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.