Examples of LagartoParser


Examples of jodd.lagarto.LagartoParser

    @Override
    public Iterator<URL> getEmbeddedResourceURLs(byte[] html, URL baseUrl,
            URLCollection coll, String encoding) throws HTMLParseException {
        try {
            String contents = new String(html,encoding);
            LagartoParser lagartoParser = new LagartoParser(contents);
            JMeterTagVisitor tagVisitor = new JMeterTagVisitor(new URLPointer(baseUrl), coll);
            lagartoParser.parse(tagVisitor);
            return coll.iterator();
        } catch (LagartoException e) {
            // TODO is it the best way ? https://issues.apache.org/bugzilla/show_bug.cgi?id=55634
            if(log.isDebugEnabled()) {
                log.debug("Error extracting embedded resource URLs from:'"+baseUrl+"', probably not text content, message:"+e.getMessage());
View Full Code Here

Examples of jodd.lagarto.LagartoParser

  /**
   * Creates DOM tree from provided content.
   */
  public Document parse(char[] content) {
    LagartoParser lagartoParser = new LagartoParser(content, true);
    return doParse(lagartoParser);
  }
View Full Code Here

Examples of jodd.lagarto.LagartoParser

  /**
   * Creates DOM tree from the provided content.
   */
  public Document parse(String content) {
    LagartoParser lagartoParser = new LagartoParser(content, true);
    return doParse(lagartoParser);
  }
View Full Code Here

Examples of jodd.lagarto.LagartoParser

  /**
   * Parses decorator.
   */
  protected DecoraTag[] parseDecorator(char[] decoraContent) {
    LagartoParser lagartoParser = new LagartoParser(decoraContent, true);
    DecoratorTagVisitor visitor = new DecoratorTagVisitor();
    lagartoParser.parse(visitor);
    return visitor.getDecoraTags();
  }
View Full Code Here

Examples of jodd.lagarto.LagartoParser

  /**
   * Parses page and extracts decora regions for replacements.
   */
  protected void parsePage(char[] pageContent, DecoraTag[] decoraTags) {
    LagartoParser lagartoParser = new LagartoParser(pageContent, true);
    PageRegionExtractor writer = new PageRegionExtractor(decoraTags);
    lagartoParser.parse(writer);
  }
View Full Code Here

Examples of jodd.lagarto.LagartoParser

        try {
            Float ieVersion = extractIEVersion(userAgent);
           
            String contents = new String(html,encoding);
            // As per Jodd javadocs, emitStrings should be false for visitor for better performances
            LagartoParser lagartoParser = new LagartoParser(contents, false);
            LagartoParserConfig<LagartoParserConfig<?>> config = new LagartoParserConfig<LagartoParserConfig<?>>();
            config.setCaseSensitive(false);
            // Conditional comments only apply for IE < 10
            config.setEnableConditionalComments(isEnableConditionalComments(ieVersion));
           
            lagartoParser.setConfig(config);
            JMeterTagVisitor tagVisitor = new JMeterTagVisitor(new URLPointer(baseUrl), coll, ieVersion);
            lagartoParser.parse(tagVisitor);
            return coll.iterator();
        } catch (LagartoException e) {
            // TODO is it the best way ? https://issues.apache.org/bugzilla/show_bug.cgi?id=55634
            if(log.isDebugEnabled()) {
                log.debug("Error extracting embedded resource URLs from:'"+baseUrl+"', probably not text content, message:"+e.getMessage());
View Full Code Here

Examples of jodd.lagarto.LagartoParser

   * Parses decorator file and collects {@link jodd.decora.parser.DecoraTag Decora tags}
   * used in template. Returned Decora tags have start and end index set,
   * but their region is not set.
   */
  protected DecoraTag[] parseDecorator(char[] decoraContent) {
    LagartoParser lagartoParser = new LagartoParser(decoraContent, true);
    lagartoParser.getConfig().setEnableRawTextModes(false);

    DecoratorTagVisitor visitor = new DecoratorTagVisitor();
    lagartoParser.parse(visitor);
    return visitor.getDecoraTags();
  }
View Full Code Here

Examples of jodd.lagarto.LagartoParser

  /**
   * Parses target page and extracts Decora regions for replacements.
   */
  protected void parsePage(char[] pageContent, DecoraTag[] decoraTags) {
    LagartoParser lagartoParser = new LagartoParser(pageContent, true);
    PageRegionExtractor writer = new PageRegionExtractor(decoraTags);
    lagartoParser.parse(writer);
  }
View Full Code Here

Examples of jodd.lagarto.LagartoParser

  /**
   * Processes input JSP content and replace macros.
   */
  public String process(final String input) {
    LagartoParser lagartoParser = new LagartoParser(input, true);

    final MutableInteger lastPosition = new MutableInteger(0);
    final StringBuilder sb = new StringBuilder();

    lagartoParser.parse(new EmptyTagVisitor() {
      @Override
      public void tag(Tag tag) {
        if (tag.getType() == TagType.SELF_CLOSING) {
          if (tag.matchTagNamePrefix(tagPrefix)) {
            int tagStart = tag.getTagPosition();
View Full Code Here

Examples of jodd.lagarto.LagartoParser

  public int doEndTag() {
    return EVAL_PAGE;
  }

  protected String populateForm(String formHtml, FormFieldResolver resolver) {
    LagartoParser lagartoParser = new LagartoParser(formHtml, true);
    StringBuilder result = new StringBuilder();

    lagartoParser.parse(new FormProcessorVisitor(result, resolver));

    return result.toString();
  }
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.