Examples of parseFragment()


Examples of com.google.caja.parser.html.DomParser.parseFragment()

      MessageQueue mq = makeMessageQueue();
      // Newline works around Caja parser issue with certain short-form
      // HTML - the internal Lexer gets confused. A bug has been filed w/ Caja.
      // Even so, adding the newline is innocuous for any HTML.
      DomParser parser = getDomParser(source + '\n', mq);
      DocumentFragment fragment = parser.parseFragment();
      // Get rid of the newline, if maintained.
      Node lastChild = fragment != null ? fragment.getLastChild() : null;
      if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
        String lastText = lastChild.getTextContent();
        if ("\n".equals(lastText)) {
View Full Code Here

Examples of com.google.caja.parser.html.DomParser.parseFragment()

      input = p.parseStyleSheet();
      tq.expectEmpty();
    } else if (ContentType.HTML == type) {
      DomParser p = new DomParser(new HtmlLexer(cp), false, is, mq);
      //if (p.getTokenQueue().isEmpty()) { return null; }
      input = new Dom(p.parseFragment());
      p.getTokenQueue().expectEmpty();
    } else {
      throw new SomethingWidgyHappenedError("Can't classify input " + is);
    }
    return input;
View Full Code Here

Examples of com.google.caja.parser.html.DomParser.parseFragment()

    HtmlLexer lexer = new HtmlLexer(cp);
    lexer.setTreatedAsXml(asXml);
    TokenQueue<HtmlTokenType> tq = new TokenQueue<HtmlTokenType>(
        lexer, is, DomParser.SKIP_COMMENTS);
    DomParser p = new DomParser(tq, asXml, mq);
    Node t = asDoc ? p.parseDocument() : p.parseFragment();
    tq.expectEmpty();
    return t;
  }

  protected Element markup(CharProducer cp) throws ParseException {
View Full Code Here

Examples of com.google.caja.parser.html.DomParser.parseFragment()

    CharProducer cp = CharProducer.Factory.fromString(input, is);
    boolean okToContinue = true;
    Dom inputNode = null;
    try {
      DomParser p = new DomParser(new HtmlLexer(cp), false, is, mq);
      inputNode = new Dom(p.parseFragment());
      p.getTokenQueue().expectEmpty();
    } catch (ParseException e) {
      mq.addMessage(e.getCajaMessage());
      okToContinue = false;
    }
View Full Code Here

Examples of com.google.caja.parser.js.Parser.parseFragment()

      Parser p = new Parser(tq, mq);
      ptn = p.parse();
      tq.expectEmpty();
    } else {
      DomParser p = new DomParser(new HtmlLexer(cp), false, is, mq);
      ptn = new Dom(p.parseFragment());
      p.getTokenQueue().expectEmpty();
    }
    return ptn;
  }
View Full Code Here

Examples of com.google.caja.parser.js.Parser.parseFragment()

      Parser p = new Parser(tq, mq);
      ptn = p.parse();
      tq.expectEmpty();
    } else {
      DomParser p = new DomParser(new HtmlLexer(cp), false, is, mq);
      ptn = new Dom(p.parseFragment());
      p.getTokenQueue().expectEmpty();
    }
    return ptn;
  }
View Full Code Here

Examples of com.google.caja.parser.js.Parser.parseFragment()

      Parser p = new Parser(tq, mq);
      ptn = p.parse();
      tq.expectEmpty();
    } else {
      DomParser p = new DomParser(new HtmlLexer(cp), false, is, mq);
      ptn = new Dom(p.parseFragment());
      p.getTokenQueue().expectEmpty();
    }
    return ptn;
  }
View Full Code Here

Examples of com.google.caja.parser.js.Parser.parseFragment()

      Parser p = new Parser(tq, mq);
      ptn = p.parse();
      tq.expectEmpty();
    } else {
      DomParser p = new DomParser(new HtmlLexer(cp), false, is, mq);
      ptn = new Dom(p.parseFragment());
      p.getTokenQueue().expectEmpty();
    }
    return ptn;
  }
View Full Code Here

Examples of com.google.caja.parser.js.Parser.parseFragment()

      input = p.parseStyleSheet();
      tq.expectEmpty();
    } else if (ContentType.HTML == type) {
      DomParser p = new DomParser(new HtmlLexer(cp), false, is, mq);
      //if (p.getTokenQueue().isEmpty()) { return null; }
      input = new Dom(p.parseFragment());
      p.getTokenQueue().expectEmpty();
    } else {
      throw new SomethingWidgyHappenedError("Can't classify input " + is);
    }
    return input;
View Full Code Here

Examples of org.thymeleaf.templateparser.ITemplateParser.parseFragment()

        final Configuration configuration = arguments.getConfiguration();
       
        final ITemplateParser templateParser =
                configuration.getTemplateModeHandler(templateMode).getTemplateParser();
     
        final List<Node> fragmentNodes = templateParser.parseFragment(configuration, fragment);
       
        if (this.fragmentCache != null) {
            this.fragmentCache.put(cacheKey, fragmentNodes);
            return cloneFragmentNodes(fragmentNodes);
        }
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.