Package javax.swing.text.html.parser

Examples of javax.swing.text.html.parser.ParserDelegator


        this.RootFolder = root;
        this.folderstring = new StringBuilder(YMarkTables.BUFFER_LENGTH);
        this.folderstring.append(this.RootFolder);       
        this.bmk = new YMarkEntry();
       
        this.htmlParser = new ParserDelegator();
       
      this.state = STATE.NOTHING;
    this.prevTag = null;
  }
View Full Code Here


    public HTMLDocLinkDetector(StyleSheet ss) {
      super(ss);
     
      setAsynchronousLoadPriority(4);
      setTokenThreshold(100);
      setParser(new ParserDelegator());
    }
View Full Code Here

  }
 
  public IValue readHTMLFile(ISourceLocation file, IEvaluatorContext ctx) {
    try (Reader reader = ctx.getResolverRegistry().getCharacterReader(file.getURI())) {
      Constructor cons = new Constructor();
      new ParserDelegator().parse(reader, cons, true);
      return cons.getValue();
    } catch (MalformedURLException e) {
      throw RuntimeExceptionFactory.malformedURI(file.getURI().toASCIIString(), null, null);
    } catch (IOException e) {
      throw RuntimeExceptionFactory.io(factory.string(e.getMessage()), null, null);
View Full Code Here

     * @param uri DOCUMENT ME!
     *
     * @throws IOException DOCUMENT ME!
     */
    public HTML(String uri) throws IOException {
        ParserDelegator pd = new ParserDelegator();
        htmlHandler = new HTMLHandler();
        pd.parse(getReader(uri), htmlHandler, true);
    }
View Full Code Here

    /**
     * Parses a URI.
     */
    public void parse(URI uri) throws ParseException {
        try {
            ParserDelegator delagator = new ParserDelegator();
            handler = new SwingHTMLHandler();

            Reader reader = new PreParser().parse(getReader(uri));
            delagator.parse(reader, handler, true);
        } catch (IOException e) {
            throw new ParseException(e);
        }
    }
View Full Code Here

  }

  private static List<String> extractText(Reader reader) throws IOException {
    final ArrayList<String> list = new ArrayList<String>();

    ParserDelegator parserDelegator = new ParserDelegator();
    ParserCallback parserCallback = new ParserCallback() {
      public void handleText(final char[] data, final int pos) {
        list.add(new String(data));
      }

      public void handleStartTag(Tag tag, MutableAttributeSet attribute, int pos) {
      }

      public void handleEndTag(Tag t, final int pos) {
      }

      public void handleSimpleTag(Tag t, MutableAttributeSet a, final int pos) {
      }

      public void handleComment(final char[] data, final int pos) {
      }

      public void handleError(final java.lang.String errMsg, final int pos) {
      }
    };
    parserDelegator.parse(reader, parserCallback, true);
    return list;
  }
View Full Code Here

        if (source != null && TARGET_SELF.equals(target)) {
            processTarget(source, src);
        } else if (source != null && TARGET_PARENT.equals(target)) {
            final Element parent = source.getParentElement();
            if (getParser() == null) {
                setParser(new ParserDelegator());
            }
            try {
                setOuterHTML(parent, "<frame src=\"" + src + "\">");
            } catch (BadLocationException e) {
            } catch (IOException e) {
View Full Code Here

    InputStream is = connection.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    HTMLEditorKit htmlKit = new HTMLEditorKit();
    HTMLDocument htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument();
    HTMLEditorKit.Parser parser = new ParserDelegator();
    HTMLEditorKit.ParserCallback callback = htmlDoc.getReader(0);
    parser.parse(br, callback, true);

    ElementIterator iterator = new ElementIterator(htmlDoc);
    Element element;
    while ((element = iterator.next()) != null)
      {
View Full Code Here

  }

  public void parse(String html)
             throws Exception
  {
    ParserDelegator delegator = new ParserDelegator();
    delegator.parse(new StringReader(html), this, true);
  }
View Full Code Here

  public String verify(String html, String expected, String about)
  {
    out.setLength(0);

    HTMLEditorKit.ParserCallback callback = this;
    ParserDelegator delegator = new ParserDelegator();
    try
      {
      delegator.parse(new StringReader(html), callback, true);
      }
    catch (IOException ex)
      {
      harness.fail("Unexpected exception " + ex.getMessage() +
                   " while parsing " + html
View Full Code Here

TOP

Related Classes of javax.swing.text.html.parser.ParserDelegator

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.