Package org.lobobrowser.html.parser

Examples of org.lobobrowser.html.parser.DocumentBuilderImpl


        String actualURI = urlForLoading.toExternalForm();
        // Note that DocumentBuilderImpl needs to be
        // constructed by passing both a UserAgentContext
        // and an HtmlRendererContext in this case, so
        // that form.submit() can take effect.
        DocumentBuilderImpl builder = new DocumentBuilderImpl(this.uacontext, this);
        String charset = org.lobobrowser.util.Urls.getCharset(connection);
        InputSourceImpl is = new InputSourceImpl(bin, actualURI, charset);
        this.document = (HTMLDocumentImpl) builder.parse(is);
      } finally {
        in.close();
      }
    } catch(Exception err) {
      this.document = null;
View Full Code Here


          String actualURI = urlForLoading.toExternalForm();
          // Note that DocumentBuilderImpl needs to be
          // constructed by passing both a UserAgentContext
          // and an HtmlRendererContext in this case, so
          // that form.submit() can take effect.
          DocumentBuilderImpl builder = new DocumentBuilderImpl(this.uacontext, this);
          String charset = org.lobobrowser.util.Urls.getCharset(connection);
          InputSourceImpl is = new InputSourceImpl(bin, actualURI, charset);
          this.document = (HTMLDocumentImpl) builder.parse(is);
        } finally {
          in.close();
        }
      } catch(Exception err) {
        this.document = null;
View Full Code Here

    UserAgentContext ucontextMessage = new SimpleUserAgentContext();
    HtmlRendererContext rcontextMessage = new MWHtmlRendererContext(
        textMessage, ucontextMessage);
    textMessage.setPreferredSize(new Dimension(500, 150));
    textMessage.setMinimumSize(new Dimension(100, 100));
    DocumentBuilderImpl dbi = new DocumentBuilderImpl(
        ucontextMessage, rcontextMessage);
    InputSource is = new InputSource(new StringReader(Version.MESSAGE));
    is.setSystemId(EnumWikipedia.EN.getConfiguration().getString(WPCConfigurationString.HELP_URL));
    try {
      textMessage.setDocument(dbi.parse(is), rcontextMessage);
    } catch (SAXException e) {
      // Nothing
    } catch (IOException e) {
      // Nothing
    }
View Full Code Here

    }
    // Display description
    if ((algorithm != null) && (description != null)) {
      // Error type description
      try {
        DocumentBuilderImpl dbi = new DocumentBuilderImpl(ucontext, rcontextDescription);
        InputSource is = new InputSource(new StringReader(description));
        CheckWiki cw = APIFactory.getCheckWiki();
        is.setSystemId(cw.getUrlDescription(getWikipedia(), algorithm));
        Document document = dbi.parse(is);
        textDescription.setDocument(document, rcontextDescription);
      } catch (SAXException e) {
        textDescription.clearDocument();
      } catch (IOException e) {
        textDescription.clearDocument();
      }

      // Parameters description
      try {
        Configuration config = Configuration.getConfiguration();
        boolean secured = config.getBoolean(null, ConfigurationValueBoolean.SECURE_URL);
        EnumWikipedia wiki = getWikipedia();
        String translationPage = wiki.getConfiguration().getString(
            WPCConfigurationString.CW_TRANSLATION_PAGE);
        String url = wiki.getSettings().getURL(translationPage, true, secured);
        StringBuilder parametersDescription = new StringBuilder();
        parametersDescription.append(GT._(
            "The error n°{0} can be configured with the following parameters in the <a href=\"{1}\">translation file</a> :",
            new Object[] { Integer.toString(errorNumber), url }));
        parametersDescription.append("\n<ul>");
        Map<String, String> parameters = algorithm.getParameters();
        for (Map.Entry<String, String> entry : parameters.entrySet()) {
          parametersDescription.append("<li><b>");
          parametersDescription.append(entry.getKey());
          parametersDescription.append("</b>: ");
          parametersDescription.append(entry.getValue());
          parametersDescription.append("</li>\n");
        }
        parametersDescription.append("</ul>");
        DocumentBuilderImpl dbi = new DocumentBuilderImpl(ucontext, rcontextParameters);
        InputSource is = new InputSource(new StringReader(parametersDescription.toString()));
        is.setSystemId(url);
        Document document = dbi.parse(is);
        textParameters.setDocument(document, rcontextParameters);
      } catch (SAXException e) {
        textParameters.clearDocument();
      } catch (IOException e) {
        textParameters.clearDocument();
View Full Code Here

  /* (non-Javadoc)
   * @see org.wikipediacleaner.gui.swing.worker.HtmlPreview#setHtml(java.lang.String)
   */
  public void setHtml(String text) {
    try {
      DocumentBuilderImpl dbi = new DocumentBuilderImpl(ucontext, rcontext);
      InputSource is = new InputSource(new StringReader(text));
      is.setSystemId(getWikipedia().getSettings().getURL(textTitle.getText(), true, false));
      Document document = dbi.parse(is);
      htmlPreview.setDocument(document, rcontext);
    } catch (SAXException e) {
      htmlPreview.clearDocument();
    } catch (IOException e) {
      htmlPreview.clearDocument();
View Full Code Here

   */
  void updateInformation() {
    try {
      lblTitle.setText(title);
      if (html) {
        DocumentBuilderImpl dbi = new DocumentBuilderImpl(
            ucontextInformation, rcontextInformation);
        InputSource is = new InputSource(new StringReader(information));
        is.setSystemId("http://localhost");
        textInformation.setDocument(dbi.parse(is), rcontextInformation);
      } else {
        textPane.setText(information);
      }
    } catch (SAXException e) {
      // Nothing
View Full Code Here

TOP

Related Classes of org.lobobrowser.html.parser.DocumentBuilderImpl

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.