Package org.xhtmlrenderer.resource

Examples of org.xhtmlrenderer.resource.XMLResource


     * @param uri The URI which could not be loaded.
     *
     * @return An XMLResource containing XML which about the failure.
     */
    private XMLResource getNotFoundDocument(String uri) {
        XMLResource xr;
        String notFound = "<html><h1>Document not found</h1><p>Could not access URI <pre>"
                + uri + "</pre></p></html>";

        xr = XMLResource.load(new StringReader(notFound));
        return xr;
View Full Code Here


     * @param uri Location of the XML source.
     * @return An XMLResource containing the image.
     */
    public XMLResource getXMLResource(String uri) {
        InputStream inputStream = resolveAndOpenStream(uri);
        XMLResource xmlResource;
        try {
            xmlResource = XMLResource.load(inputStream);
        } finally {
            if (inputStream != null) {
                try {
View Full Code Here

                file = new File(new URI(uri));
            } catch (URISyntaxException e) {
                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
        }
        XMLResource xr = null;
        InputStream inputStream = null;
        try {
            URLConnection uc = new URL(uri).openConnection();
            uc.connect();
            // TODO: String contentType = uc.getContentType(); Maybe should popup a choice when content/unknown!
View Full Code Here

        Document dom = loadDocument(url);
        setDocument(dom, url);
    }

    protected Document loadDocument(final String uri) {
        XMLResource xmlResource = _sharedContext.getUac().getXMLResource(uri);
        if (xmlResource == null) {
            return null;
        }
        return xmlResource.getDocument();
    }
View Full Code Here

            int startPage, int endPage) {
        print(loadDocument(url), url, nsh, jobName, startPage, endPage);
    }

    protected Document loadDocument(final String uri) {
        XMLResource xmlResource = _sharedContext.getUac().getXMLResource(uri);
        if (xmlResource == null) {
            return null;
        }
        return xmlResource.getDocument();
    }
View Full Code Here

            if (file.isDirectory()) {
                String dirlist = DirectoryLister.list(file);
                return XMLResource.load(new StringReader(dirlist));
            }
        }
        XMLResource xr = null;
        URLConnection uc = null;
        InputStream inputStream = null;
        try {
            uc = new URL(uri).openConnection();
            uc.connect();
View Full Code Here

   * @param uri The URI which could not be loaded.
   *
   * @return An XMLResource containing XML which about the failure.
   */
  private XMLResource getNotFoundDocument(String uri) {
        XMLResource xr;

        // URI may contain & symbols which can "break" the XHTML we're creating
        String cleanUri = GeneralUtil.escapeHTML(uri);
        String notFound = "<html><h1>Document not found</h1><p>Could not access URI <pre>" + cleanUri + "</pre></p></html>";

View Full Code Here

        InputStream inputStream = getInputStream(uri);
        if (inputStream == null) {
            XRLog.exception("couldn't get InputStream for " + uri);
            return null;
        }
        XMLResource xmlResource;
        try {
            xmlResource = XMLResource.load(inputStream);
        } catch (Exception e) {
            XRLog.exception("unable to load xml resource: " + uri, e);
            return null;
View Full Code Here

            }
        });
    }

    private XMLResource getErrorDocument(String reason) {
        XMLResource xr;
        String cleanUri = GeneralUtil.escapeHTML(uri);
        String notFound = "<html><h1>Document not found</h1><p>Could not load URI <pre>" + cleanUri + "</pre>, because: " + reason + "</p></html>";
        xr = XMLResource.load(new StringReader(notFound));
        return xr;
    }
View Full Code Here

   * @param uri Location of the XML source.
   * @return An XMLResource containing the image.
   */
    public XMLResource getXMLResource(String uri) {
        InputStream inputStream = resolveAndOpenStream(uri);
        XMLResource xmlResource;
        try {
            xmlResource = XMLResource.load(inputStream);
        } finally {
            if ( inputStream != null ) try {
                inputStream.close();
View Full Code Here

TOP

Related Classes of org.xhtmlrenderer.resource.XMLResource

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.