Package com.google.caja.parser.html

Examples of com.google.caja.parser.html.Dom


    super(cssSchema, htmlSchema);
  }

  @Override
  Job makeJobFromHtml(DocumentFragment html, URI baseUri) {
    return Job.domJob(new Dom(html), baseUri);
  }
View Full Code Here


       */
     
      InputSource is = new InputSource(javaGadgetUri);
      boolean safe = false;

      compiler.addInput(new Dom(root), javaGadgetUri);

      try {
        if (!compiler.run()) {
          throw new GadgetRewriteException("Gadget has compile errors");
        }
View Full Code Here

      if (htmlInline) {
        compiler.setGoals(
            compiler.getGoals().without(PipelineMaker.HTML_SAFE_STATIC));
      }

      Dom html = null;
      try {
        html = (Dom) new ParserContext(mq)
            .withInput(cp)
            .withInput(is)
            .withInput(ContentType.HTML)
View Full Code Here

    super(cssSchema, htmlSchema);
  }

  @Override
  Job makeJobFromHtml(Node html, URI baseUri) {
    return Job.domJob(new Dom(html), baseUri);
  }
View Full Code Here

         it.hasNext();) {
      JobEnvelope env = it.next();
      if (env.fromCache) { continue; }
      Job job = env.job;
      if (job.getType() != ContentType.HTML) { continue; }
      Dom dom = (Dom) job.getRoot();
      Node node = dom.getValue();
      URI baseUri = baseUri(node, job.getBaseUri(), dom.getFilePosition());
      if (baseUri != null) {
        try {
          baseUri = URI.create(UriUtil.normalizeUri(baseUri.toString()));
        } catch (URISyntaxException ex) {
          mq.addMessage(
              PluginMessageType.MALFORMED_URL, dom.getFilePosition(),
              MessagePart.Factory.valueOf(baseUri.toString()));
          baseUri = null;
        }
      }
      if (baseUri != null) {
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 = new Dom(p.parseFragment());
      p.getTokenQueue().expectEmpty();
    } else {
      throw new SomethingWidgyHappenedError("Can't classify input " + is);
    }
    return input;
View Full Code Here

    Element a = doc.createElement("a");
    a.setAttribute("onclick", "foo + bar;");
    a.appendChild(doc.createTextNode("foo"));
    root.appendChild(script);
    root.appendChild(a);
    execGadget(new Dom(root), "");
  }
View Full Code Here

  public final void testPartialScript() throws Exception {
    PluginMeta meta = new PluginMeta();
    PluginCompiler compiler = new PluginCompiler(
        TestBuildInfo.getInstance(), meta, mq);
    compiler.setMessageContext(mc);
    Dom html = new Dom(htmlFragment(fromString("<script>{</script>")));
    compiler.addInput(html, is.getUri());

    boolean passed = compiler.run();
    assertFalse(passed);
View Full Code Here

        MessageType.END_OF_FILE, MessageLevel.ERROR,
        FilePosition.instance(is, 1, 9, 9, 1));
  }

  private void execGadget(String gadgetSpec, String tests) throws Exception {
    execGadget(new Dom(htmlFragment(fromString(gadgetSpec))), tests);
  }
View Full Code Here

    URI uri = guessURI(base, url);
    InputSource is = new InputSource(uri);
    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

TOP

Related Classes of com.google.caja.parser.html.Dom

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.