Package com.google.caja.parser.html

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


    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


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

  @Override
  protected Document parseDomImpl(String source) throws GadgetException {
    MessageQueue mq = new SimpleMessageQueue();
    try {
      DomParser parser = getDomParser(source, mq);
      Document doc = parser.parseDocument().getOwnerDocument();

      VanillaCajaHtmlSerializer serializer = new VanillaCajaHtmlSerializer();
      HtmlSerialization.attach(doc, serializer, null);
      return doc;
    } catch (ParseException e) {
View Full Code Here

  @Override
  protected Document parseDomImpl(String source) throws GadgetException {
    MessageQueue mq = new SimpleMessageQueue();
    try {
      DomParser parser = getDomParser(source, mq);
      Document doc = parser.parseDocument().getOwnerDocument();

      VanillaCajaHtmlSerializer serializer = new VanillaCajaHtmlSerializer();
      HtmlSerialization.attach(doc, serializer, null);
      return doc;
    } catch (ParseException e) {
View Full Code Here

    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 = Dom.transplant(p.parseDocument());
      p.getTokenQueue().expectEmpty();
    } catch (ParseException e) {
      mq.addMessage(e.getCajaMessage());
      okToContinue = false;
    }
View Full Code Here

      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 = Dom.transplant(p.parseDocument());
      p.getTokenQueue().expectEmpty();
    } else {
      throw new SomethingWidgyHappenedError("Can't classify input " + is);
    }
    return input;
View Full Code Here

    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

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.