Exporting to textile/html file

Hi everyone..I'm sorta new to this java thing..been working on it for a year or so now..and right now im working on this little project where I search a web crawler file and return a string array of results into list in a GUI I made.
What I basically want now is to export the result to a text file..preferrably a html file where I can then open the html file and then it'll have all the url links in it..so far I have this:
private class exportListener implements ActionListener
        public void actionPerformed(ActionEvent e)
            String[] result = parent.getResult();
            if(result == null)
                return;
            JFileChooser chooser = new JFileChooser();
            chooser.setAcceptAllFileFilterUsed(false);
            chooser.setFileFilter(new HtmlFileFilter());
            chooser.setDialogType(JFileChooser.SAVE_DIALOG);
            int returnVal = chooser.showSaveDialog(parent);
            if(returnVal == JFileChooser.CANCEL_OPTION)
                return;
            File fl = chooser.getSelectedFile();
            String path = fl.getPath() + ".html";
            searchIF.exportResultAsHtml(path);
            System.out.println(path);
    private class HtmlFileFilter extends FileFilter
        public String getDescription(){return "Html";}
        public boolean accept(File pathname)
            String name = pathname.getPath();
            //Just checking to see if the filename ends with html.
            if (name.toLowerCase().substring(name.lastIndexOf('.') + 1).equals("html"))
                return true;
            return false;
        }These are basically handling the whole process of preparing to export to html..and then I made a SearchHandler which is accessed through an interface, and I have a method that reads like this:
     public void exportResultAsHtml(String path)
    What I'd like some help/advice on..is how I should process it..ie. what should I put in this method to setup the result into a html file with body etc and such, so it comes out in the file something like this:
www.something.com/index.html
www.somethingelse.com/index.html
www.somethingdifferent.com/index.html
And so that they are links you can click and it'll send you to the clicked link.

Here's a starter:
     private void exportAsHtml(final File target, final String[] links)
          throws IOException {
          if (target == null) {
               throw new IllegalArgumentException("No output file specified.");
          FileOutputStream fileOut = null;
          try {
               fileOut = new FileOutputStream(target);
               PrintWriter writer =  new PrintWriter(fileOut);
               writer.println("<html>");
               writer.println("<head><h1>Web Crawler Links</hi></head>");
               writer.println("<body><ul>");
               if (links != null) {
                    for (int current = 0; current < links.length; current++) {
                         writer.println("<li><a href='" + links[current] + "'>" + links[current] + "</a></li>");
               writer.println("</ul></body>");
               writer.println("</html>");
               writer.flush();
          finally {
               if (fileOut != null) {
                    fileOut.close();
     }- Saish

Similar Messages

  • Manual backup of bookmark json file is empty, export of bookmark html file "self-deletes"

    I'm now using Firefox 17.0.11esr in Win 7 at work and 26.0 in Win XP at home. I tried 24.2.0esr at work, but had to return to the earlier version, because of this problem below, which also happens with my home machine:
    I cannot save, manually or automatically, a usable bookmarks json file for use as a backup. The files are always empty.
    When I try to export a bookmarks html file, it begins to create and save it, but then "self-deletes" it before it's done.
    Why is this a problem with 24.2.0esr and 26.0, but not 17.0.11esr? What can I do about it?
    Thanks

    You can try to create a new profile and keep both profiles open at the same time.<br />
    You can do that by starting the second instance with the -no-remote command line switch (see further down).
    Then you can do a copy and paste of the bookmarks in the Bookmarks Manager (Library) from the current profile to the Library of the new profile to create a new places.sqlite database file.<br />
    If that works then you can copy this places.sqlite file to your current profile folder.<br />
    You will lose the history, but it is possible to copy history items to a bookmarks folder in the new profile.
    See "Creating a profile":
    *https://support.mozilla.org/kb/profile-manager-create-and-remove-firefox-profiles
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Profile_issues
    You can also opt to keep using the new profile and transfer some files from the old profile to the new profile, but be cautious not to copy corrupted files to avoid carrying over the problem.
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox
    See:
    *http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
    Use the -no-remote command line switch to open another Firefox instance with its own profile and run multiple Firefox instances simultaneously.
    *http://kb.mozillazine.org/Opening_a_new_instance_of_Firefox_with_another_profile
    *https://developer.mozilla.org/Mozilla/Multiple_Firefox_Profiles

  • What are the different ways to Export JTable to HTML file

    What would be best way of going about (well the easiest way) in exporting a jtable to html file, I can only think of one...
    Would it be to create file, then loop through Jtable and write data to the file using appriopiate tr, td tags..
    Are there any other methods which are better?

    Perhaps you could use XMLEncoder to write the JTable to an xml stream, and then use xslt to convert it into the html you want. Not sure if that is any easier.

  • Trouble exporting results to html file

    Hi
    When I query a clob (sql_text column on DBA_HIST_SQLTEXT) I am not able to to export the results to an html file.
    Right click results|select all|export data|html
    The file dialog does not come up.
    Works fine without clob data, is this a limitation of the tool?
    Thanks
    Tom

    Hi,
    Thanks for answering my post.
    Version info
    Java(TM) Platform     1.5.0_06
    Oracle IDE     1.5.5.59.69
    Versioning Support     1.5.5.59.69
    Here is my SQL statement
    SELECT
    A.SQL_ID,
    round(A.ELAPSED_TIME_TOTAL/1000000) "ELAPSED_TIME_TOTAL (Seconds)",
    B.BEGIN_INTERVAL_TIME, B.END_INTERVAL_TIME,
    to_char(A.EXECUTIONS_TOTAL,'999,999,999,999') EXECUTIONS_TOTAL,
    to_char(A.BUFFER_GETS_DELTA , '999,999,999,999') BUFFER_GETS_DELTA,
    to_char(A.BUFFER_GETS_TOTAL , '999,999,999,999') BUFFER_GETS_TOTAL,
    to_char(A.DISK_READS_DELTA, '999,999,999,999') DISK_READS_DELTA,
    to_char(A.ROWS_PROCESSED_TOTAL,'999,999,999,999,999') ROWS_PROCESSED_TOTAL,
    round(A.CPU_TIME_DELTA/1000000) "CPU_TIME_DELTA (Seconds)",
    A.PARSING_SCHEMA_NAME PARSING_SCHEMA_NAME, A.MODULE MODULE,
    A.SNAP_ID, C.SQL_TEXT
    FROM
    DBA_HIST_SQLSTAT A, DBA_HIST_SNAPSHOT B, DBA_HIST_SQLTEXT C
    WHERE
    A.SNAP_ID=b.snap_id
    and a.SQL_ID=c.SQL_ID
    and (B.BEGIN_INTERVAL_TIME BETWEEN trunc(sysdate-1) + 9/24 and trunc(sysdate-1) + 9.5/24)
    I am trying to export to html format. No errors, just nothing happens. I am running the console.
    Thanks,
    Tom

  • Import bookmarks from html not working (YES, I know it really IS an html file and not JSON)

    My objective is to make a global edit to the bookmarks in one folder. To do so, I exported to an HTML file, opened that file in Notepad, deleted all the other bookmarks, and did a search-and-replace to correct the ones I was trying to fix. Saved the file and attempted to import into Firefox. I *can* open the file and see the links, and I can use Import and Backup to get to the file and select it for import. However, after that, NOTHING happens.

    Yes, does have .html extension and does work if opened in a tab. However, I just discovered that there was a missing > which proved to be the issue.
    Once that was corrected, the import worked as it should.
    Thanks! Your questions made me look again more closely -- I had overlooked that error MANY times earlier. :)

  • Help needed  while exporting crystal reports to HTML file format using java

    Help needed  while exporting crystal reports to HTML file format using java api(not using crystalviewer).i want to download the
    html file of the report
    thanks

    the ReportExportFormat class does not have HTML format, it has got to be XML. Export to HTML is available from CR Designer only.
    Edited by: Aasavari Bhave on Jan 24, 2012 11:37 AM

  • How can I import my IE8 bookmarks/favorites into Safari if I only have access to the data stored on my old hard drive? I can't run Windows to export them to an html file.

    My old PC died and I replaced it with a MacBook Pro.  Although I was able to copy the data from the PC's hard drive, I am unable to export my previous bookmarks/favorites to an html file because that PC won't boot.  Is there any other way to import them into Safari using the raw data stored on that drive or convert them somehow to a format I can import?

    You can only use a JSON backup to restore all bookmarks in Firefox.<br />
    If you need to import Firefox bookmarks in Safari then you need to (re)install Firefox and export the bookmarks to an HTML file.
    *http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • Exporting a String Array to an HTML file

    Hey everyone..I'm currently making lots of progress in my project...but right now I've been trying to make a button that exports my search results to an html file...basically what I've made is a search engine to search webcrawler files...
    The result list I get (which is actually a string array), I want to export to html so I can open that html file and find all the links that were found in the search I made..What I have so far is this, but it's not working yet, any help? :
        private class exportListener implements ActionListener
            public void actionPerformed(ActionEvent e)
                String[] result = parent.getResult();
                if(result == null)
                    return;
                JFileChooser chooser = new JFileChooser();
                chooser.setAcceptAllFileFilterUsed(false);
                chooser.setFileFilter(new HtmlFileFilter());
                chooser.setDialogType(JFileChooser.SAVE_DIALOG);
                int returnVal = chooser.showSaveDialog(parent);
                if(returnVal == JFileChooser.CANCEL_OPTION)
                    return;
                File fl = chooser.getSelectedFile();
                String path = fl.getPath() + ".html";
                searchIF.exportResultAsHtml(path);
                System.out.println(path);
        private class HtmlFileFilter extends FileFilter
            public String getDescription(){return "Html";}
            public boolean accept(File pathname)
                String name = pathname.getPath();
                //Just checking to see if the filename ends with html.
                if (name.toLowerCase().substring(name.lastIndexOf('.') + 1).equals("html"))
                    return true;
                return false;
            }

    Actually..nevermind, sorry.

  • How do I export bookmarks from Firefox for Mobile (android) to an html file?

    I have bookmarks on my Firefox for Mobile v 33.1 that I would like to copy/back up to an html file. Even if I access the desktop version on my tablet I don't see the Show all Bookmarks - Import/Export option. This Android profile used to be linked through the old Firefox Sync to my PC but the issue is that I can't access it from my PC anymore as I just had to replace the hard disk. I have now installed the new Firefox on my PC but it won't sync with the old Android version as the new Firefox Sync is not compatible with the old one. Also when I go under Sync on the Android, it says the email account is deprecated.
    Going forward I understand I need to remove account on the Android, update to the new Firefox Sync and newly link PC and Android device. However I have read that If I remove the account on my Android Firefox and set up the new Firefox Sync on it, I will lose my old bookmarks and it will only start saving and syncing bookmarks from then on even if I use the same email address to set it up. If this is the case and before taking this step, is there a way I can copy my old Android bookmarks to an html file?
    All suggestions very much appreciated! I'm completely lost.
    Thanks

    Tangram that is an answer for desktop Firefox. It does not apply to Firefox for Android.
    There is no way to export bookmarks/history in Firefox for Android.
    However your Firefox sync account is unrelated to the Firefox for Android profile. You can safely remove the account without loss of data. Then set up a new Sync Account.

  • Need help: Problems with exported Dreamweaver html file in different browsers

    I'm trying to send out a newsletter, and had our designer create it in Dreamweaver, and then export and html file which we uploaded.  For some reason it looks wrong on Mac's, Gmail, and a few issues with Outlook.  Does anyone know how to help with this, or had to work around this problem in the past?
    I've attached our html file as well.
    We're an eco startup with limited time and budget - so any help you have would be so appreciated.
    Thank you!!

            World Centric Monthly Newsletter   August 2009     
    Palo Alto Joins the Ban Against          
             Non-Recyclable Materials
           This Spring, Palo Alto joined the list of more than 30 cities and counties in California who are making good on their efforts toward reducing their greenhouse gas emissions
           by enacting partial or comprehensive bans on polystyrene (PS) foam and/or non-recyclable disposable foodservice containers. Around the same time, a California statewide ban on the use of PS containers was tabled before reaching the State Assembly floor. Representative
           Jerry Hill, one of AB 1358’s sponsors, pulled the bill due
           to concerns addressed in the Appropriations committee hearing of the bill, regarding the fiscal impacts which
           were not addressed in bill’s contents.
           Largely represented by the California Restaurant Association, opponents of AB 1358 lobbied legislative representatives and argued there would be a negative fiscal impact on struggling restaurant owners and their customers in order to accommodate the more expensive alternatives to PS containers.     There are the unquantifiable and “hidden” costs of contaminating our bodies and environment which would far surpass the fiscal impact on the plastics, restaurants and consumer industries. Studies published by the Foundation for Advancements in Science and Education have indicated that varying levels of styrene residues
             are present in 100% of all human fat tissue in the
             United States, as PS products are found to lose weight after in contact with hot or fatty/acidic foods and liquids, causing migration of the styrene into the food or fluid, ending up in the human body. On the high end, the levels were “one third of levels known to cause neurotoxic symptoms”. In the environment,
             PS is rarely recycled and does not biodegrade.     Supporting safer alternatives to polystyrene, in addition to the collection infrastructure and processing mechanisms for the compostable and recyclable products would help create more green jobs in the long run and would be a move in the right direction away from unnecessary harm
           to our health, our communities and our world. Keep your eyes open for a revised version of AB 1358 in Spring 2010!     For more information about polystyrene
           visit Earth Resource.     For a partial energy, emissions and water analysis
           of polystyrene and its alternatives visit our website.           World Centric Compostable
             Hot Cup Lid
             World Centric is pleased to announce we now offer a fully compostable hot cup lid that
             fits our 10oz, 12oz, 16oz,
             and 20oz paper hot cups.
           The lids can be ordered in cases of 1000 or packs of 100.
           For more information or to order, please visit our website.           This Month
             We’d Like to Applaud
           Project Open Hand
           San Francisco's non-profit
           organization that prepares and delivers food to seniors, people living with HIV and homebound critically-ill residents. For nearly 25-years Project Open Hand has been providing “meals with love” to local residents in need of help and care in
           California’s San Francisco and Alameda counties.
           Programs include meals, groceries and nutrition information as well as education and referral programs
           for all of the people served. A staff dietitian also visits several sites per week to speak with seniors and critically ill local residents about the importance of eating well
           and staying healthy.
           Project Open Hand continues to serve nearly 800,000 annually and has served as a model for over 100 organizations across the United States and the world.
           If you are interested in making a donation,
           please visit Project Open Hand.
           Help Project Open Hand continue to do what it
           does best – deliver quality food to those in need.           
    “World Centric has gone
               about every aspect of
               business in the most
               sustainable of ways. 
               It is a model for socially
               responsible business.”
               Ari Patz
               Styrophobia                          
                   Industry Trends
               Although PLA is a sustainable alternative to a petrochemical-
               derived product, its limitation has
               been not only its cost, but its inability
               to maintain structural integrity in hot temperatures and humid conditions because of its low melting pint.
               However, researchers at Teijin
               (formerly in partnership with Cargill)
               have improved their plant-based
               ‘Biofront’ PLA polymer to be able
               to withstand higher temperatures –
               by modifying its hydrolytic resistance.
             Get more information here.                          
                   Get Great Deals!
                   Check out our clearence items.
                   Did you know?
               Styrene can leach from polystyrene.
               Over the long term, this can act as
               a neurotoxin. Studies on animals
               report harmful effects of styrene
               on red-blood cells, the liver, kidney,
               and stomach organs.
               US Environmental Protection Agency (1992) “Styrene”. Air Toxics Website.                          
                   Where to Find us:
                   CRRA Conference
                   August 2 - 5
                   Palm Desert
                          Western Foodservice
    & Hospitality Expo
                 August 30 - September 1
              Livable Green
                 September 19
    San Mateo                                
         Find us:            World Centric
    2121 Staunton Ct. Palo Alto, CA
    You are subscribed as <[email protected]>. Click here to manage your email subscription preferences.
    Click here or reply to this email with 'unsubscribe' in the subject to unsubscribe from this list or if you feel you have received this message in error.
    This message was sent from World Centric 2121 Staunton Ct Palo Alto CA 94306 United States. Click here to report email abuse.
    You are subscribed as <[email protected]>. Click here to manage your email subscription preferences.
    Click here or reply to this email with 'unsubscribe' in the subject to unsubscribe from this list or if you feel you have received this message in error.
    This message was sent from World Centric 2121 Staunton Ct Palo Alto CA 94306 United States. Click here to report email abuse.

  • Is there a workaround for exported Muse html files to render accurately when opened in DreamWeaver d

    Is there a workaround for exported Muse html files to render accurately when opened in DreamWeaver design view?

    Have a look at this thread that should answer your query - http://forums.adobe.com/message/5231996.
    Thanks,
    Vinayak

  • Can i delete my exported bookmark html file after i have re imported it and merged it with my restore of my old bookmarks? Same with the json file?

    I have recently reinstalled my OS on a new drive and have just successfully restored my old bookmarks and imported any new bookmarks I had saved since the OS install. I just want to know know if it is safe to delete the json file i restored from since this was on the old drive I want to format and can I also delete the html file i created by exporting my new bookmarks before i started this process?
    Marc

    You can keep a backup copy of that old file or make backups of the JSON backups on the new computer.<br />
    You can decide for yourself if you would have a usage for that file.<br />
    If all bookmarks have been restored successfully then you won't need this backup and you can create a new backup regularly if you have modified or added bookmarks.
    *http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • Export to PDF defaults to HTML file instead of Adobe PDF since moving to CC2014

    Hi friends!
    Help please. Ever since I moved to CC2014 my InDesign and Illustrator is defaulting to HTML files instead of Adobe PDF when exporting to PDF. I also use this same software at another workplace and this has not been a problem there. I am on PC, on Windows 7. Does anybody know of a preference or such that I can switch to correct this?
    Any help will be greatly appreciated.
    Mindy.

    This is the window I am getting when attempting to use Data merge in ID. Have used this successfully before in previous versions of InDesign. Any ideas?
    Thanks

  • How can i include css in html file when exported

    I want the CSS should be included in the html file when exported, how is that posable?

    Muse follows its own structure and keeps HTML, CSS and JS code in separate files as and when possible. If you want all that code to be merged into the HTML file itself, then there is no option to force Muse to do that. You can however, add your own CSS code into the HTML page by adding the CSS using either the Insert HTML option or using the HTML for <head> option in Page Properties > Metadata.
    Cheers,
    Vikas

  • [web] how can i set the name of an exported html file

    Hi,  I'm writing a plugin to export galleries for my homepage (standard html stuff). My current solution works and it creates a file named "index.html" and some additional stuff. Now I want to change the name of the created html file in the plugin (for example create a file galleryX.html with X being a number that is entered by the user). Is there a way to do this?  Thank you in advance, Sebastian

    I think the names of the files come from the plugin manifest. So you would create a file used as a template, and the name of that file would be the name of the resulting file.
    AddPhotoPages and AddGridPages take options to control the target HTML filename that might give you what you want, as well.

Maybe you are looking for

  • Syncing more than one album

    i want to sync more than one album from my computer, but when i sync more than one, it deletes the one i have just synced, and erases the last one, i use windows 7. thanks if someone can help.

  • WITH clause in PL/SQL

    Hi All, Can WITH clause be used in PL/SQL, example, as in during creating a cursor or inserting into a table by selecting data from another table? I received the following error while compiling a procedure which makes use of WITH. 105/6    PLS-00103:

  • Lookout limitation​s and selection of the computer system for lookout

    This is regarding the limitation of the lookout i.e. upto how much IO lookout is reccomended to use. or it is on the basis of the l4p or lks file size basis. Do you have some criteria for the selection of the computer system for lookout on the basis

  • Wired Headset for Lumia 900 with 3.5mm Jack

    Hi Would there be any recommendations for a Wired Headset with a 3.5Mm jack for headphones for a Nokia Lumia 900. I have tried the Nokia AD-54, you can hear the sound but sound quality is poor. I attached Bluetooth headsets BH-610 and BH-214, both re

  • Opera mini

    Hi, i have a problem with my opera mini on my X2-01,when i enter an address it is loading but after it says i should make setting of my dates on my device.Please help!