Help needed in tokenizer of bookmark.htm file

i created a small program that reads bookmark.htm file from ie6 or ff
and then i try to tokenize the buffer and get the urls one after one
but the output result is not good.
what do i have to do to tokenize it and get url after url?
the program:
import java.io.*;
import java.util.StringTokenizer;
public class Url2 {
public static void main(String[] args)
File inputFile = new File("d:bookmark.htm");
StringBuffer strCheck = new StringBuffer();
int data;
String searchBol = "<A HREF=\"";
String searchEol = "<DT>";
String currentToken;
try{
FileInputStream inFile = new FileInputStream(inputFile);
while( (data = inFile.read()) != -1)
//System.out.print( (char)data );
strCheck.append( (char)data );
inFile.close();
}catch(IOException e){}
StringTokenizer st =
new StringTokenizer( strCheck.toString(), searchEol );
while ( st.hasMoreTokens() ) {
currentToken = st.nextToken();
System.out.println( currentToken );
}// end main
}//end class Url2

StringTokenizer does not what you expect it to do. It will always just use single-character token-seperators. When you pass the String "<DT>" to it's constructor '<', 'D', 'T' and '>' will all work as token seperators, which is most likely not what you want it to do. Consider using Regular Expressions or good old indexOf() .

Similar Messages

  • Context Sensitive Help: Creating Links to the same .htm file

    Hi Everyone,
    My Help Context Sensitive application requires the exact name
    of the .htm file to
    bring it up. However, previously different fields on the
    application used to have
    different .htm file, associated with them. However now, I
    have them all within
    the same .htm file. But, I have to still keep the old links.
    As a results, I have to
    keep copying the same .htm file into different names to use
    the previously
    established link.
    Is there anyway, I can link all these .htm files to one .htm
    file (call it origin.htm)
    such that while the application still finds the old .htm
    files, bu they are linked to
    orgin.htm such that a required modification be only done in
    origin.htm file.
    I hope, I have been clear in expressing what I need.
    thanks Alot.

    Hi Oufi
    One way you could accomplish this is by converting each of
    these .HTM files to something called a
    redirect page. You can read more about redirect pages in the
    article linked below:
    Click
    here to read the article
    Sincerely... Rick

  • Urgent help needed, can I restore N900 Backup file...

    i owned a N900 (now sold out)
    before selling i took backup of contacts from backup restore option in application section
    now i bought a N8 but i m not able to restore my contacts
    1. is there any way to restore them in N8?
    2. if not, can i convert them in TEXT or any readable format
    urgent help needed
    thanks in advance

    The backup procedures built into the phone are only designed for restoring to the same phone (ie: in case or data corruption, software update or repair etc.), they can't usually be used to restore to a phone with a different operating system.
    You should have backed up with Ovi Suite before selling the N900, that would have been able to restore to the N8.

  • Help needed - OS Command foe deleting a file from Appplication server.

    Hi,
    I have requirement, where in i need to delete a file from the application server. It has to be done automatically. I thought of using OS Command for achieving the same. Can anyone help me in achieving it. The OS of my application server system is UNIX.
    Thanks in advance!!
    P.S: Points will be rewarded.

    Hello Sudeep,
    If you define the command for each operating system using transactions SM69 (You can test it with SM49) and then call it using SXPG_COMMAND_EXECUTE which contains a parameter defining the operating system (SY-OPSYS)
    then it does not matter which operating system is running, the function module always calls the correct version of the command.
    So, for example you could define a command 'OS_COMMAND'
    which deleted a file. This would have one version for Dos
    which said 'del', and a second version for unix which said 'rm'.
    The correct command would be specified by the call to SXPG_COMMAND_EXECUTE because the operating system parameter differentiates between the two commands.
    [USING PROCESS CHAINS IN SAP BW|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0a7cd90-0201-0010-49a1-d730a56895f4]
    SXPG_COMMAND_LIST_GET – Reads a list of external OS commands
    Thanks
    Chandran

  • Help needed in encrypting and decrypting a file

    Hello,
    I just started looking into the Java Security.I need to encrypt a file using any popular alogrithm like RSA or DES and write it to disk.and again decrypt this file at a later time when needed.
    I was checking out with different ways of doing so,but found it difficult to persist the key some where.
    Could some one help me in this regard,with a tutorial or a sample program where I will be able to give cleartext file as an input and get a ciphered text file as output and vice versa?

    Probably the simplest solution is to use password-based encryption (PBE). See http://java.sun.com/j2se/1.5.0/docs/guide/security/CryptoSpec.html#PBEEx
    for an example.

  • Help needed in executing a remote batch file

    I need to execute a batch file which is located on a remote machine through my machine. I have no idea to go about with. Please can someone help me out with can be used to execute the remote bat file. I am at present using Runtime.exec() to execute it on my machine.. But i cant use it to execute teh bat file on teh remote machine.Please help

    Below is an example server that would run on the remote host. You can connect to it using telnet from DOS prompt, it takes a Y/N to run your command in the cmd variable. I haven't included code for a client as it's really not needed for the example below.
    Change the cmd and port variables to what you need. You may need to setup firewall rules to allow your chosen port.
    Once it's running, you can test it by using "telnet localhost 1234" on your machine, localhost would obviously become the remote computer's hostname or IP.
    I am incredibly new to Java (using the forums to learn bits), so excuse any bad coding practises, I'm sure people will point them out.
    Keep in mind that this is totally insecure, so if you're using it on an untrusted network, you may want to look into encryption and providing some kind of password authentication, that, for the moment is out of my league.
    Screenshot here.
    import java.io.*;
    import java.net.*;
    class RemoteServer {
         public static int    port = 1234;           // Port to listen on
         public static String cmd  = "C:\\Test.bat"; // Command to run
         public static void main(String[] args)
              System.out.println("Waiting for connection...");
              try {
                   /* If you want the server to run forever, uncomment the while
                      loop */
                   // while (true)
                        startServer();
              } catch (IOException e) {
                   e.printStackTrace();
                   System.exit(1);
         /* Starts the server */
         private static void startServer() throws IOException
              ServerSocket server = null;
              Socket       client = null;
              String input;
              try {
                   server = new ServerSocket(port);
              } catch (IOException e) {
                   System.err.println("Unable to list on port " + port);
                   System.exit(1); // Can't listen, nothing else to do
              try {
                   client = server.accept();
                   System.out.println("Client connected... awaiting Y/N");
              } catch (IOException e) {
                   System.err.println("Unable to accept connection.");
                   System.exit(1);
              PrintWriter out = new PrintWriter(client.getOutputStream(), true);
              BufferedReader in = new BufferedReader(new InputStreamReader(
                                                     client.getInputStream()));
              out.println("You are connected, ready to launch command: <y/n>");
              while ((input = in.readLine()) != null)
                   if (input.equalsIgnoreCase("y"))
                        Runtime rt = Runtime.getRuntime();
                        rt.exec(cmd);
                        out.println("Command executed... disconnecting.");
                        System.out.println("Command executed... disconnecting client.");
                        break;
                   } else if (input.equalsIgnoreCase("n")) {
                        break;
                   } else {
                        out.println("Please enter Y/N.");
              out.close();
              in.close();
              client.close();
              server.close();
    }

  • Help needed for creating a SQLLoad control file

    I have 2 fields in my flat file
    If field1 = field2 load only field1 into tn and aux = NULL
    else if field1 != field2 load field1 into tn and field2 = aux
    Here is what I have so far - I need help with the "Where"
    -- ActiveNumbers.dat
    -- Steve J
    load data
    INFILE 'active.date'
    INTO TABLE tmp_ac_active
    APPEND
    FIELDS TERMINATED BY '|'
    (tn CHAR(10), aux CHAR(10))
    Thanks in advance
    Steve

    Thanks Joel
    Using the document you provided here is what I came up with. I notice this is 9i documents - I'm on 8. Does the SQLLoader work the same in both versions?
    This is the first time I've used this tool - No one here has even heard of it. (Well except for the DBA)
    load data
    INFILE 'active.date'
    -- Loads tn and aux if they do not match
    INTO TABLE tmp_ac_active
    WHEN tn != aux
    (tn CHARTERMINATED BY WHITESPACE,
    aux CHAR TERMINATED BY WHITESPACE)
    -- Loads only TN if both are the same
    INTO TABLE tmp_ac_active
    WHEN tn = aux
    (tn POSITION (1:10) CHAR)

  • Help Needed With Conversion of Creative Player2 files to other programs

    THR AUG th
    I have some picture, graphic and text files that have in some way been saved in the Creative Player2 format on my computer. I need to associate these files with another program so that I can reoer the images and text. Can anyone tell me what program I can use to associate these Creative Player2 files to revover them, or if there is some other way to open them... Desperate for help!!! Thanks in advance. Al [email][email protected]][email protected][/url]

    Al_Barrs wrote:
    THR AUG th?I have some picture, graphic and text files that have in some way been saved in the Creative Player2 format on my computer. I need to associate these files with another program so that I can reoer the images and text. Can anyone tell me what program I can use to associate these Creative Player2 files to revover them, or if there is some other way to open them... Desperate for help!!! Thanks in advance. Al [email][email protected]][email protected][/url]?
    What player are you referring to? Is it Creative PlayCenter 2? Playcenter doesn't save any special extension to the files. It uses all the standard extension. eg. jpg,txt.... Not sure what you are trying to say.

  • Help needed in converting Excel from XML file

    Hi Can anyone help me in converting XML in to Excel.
    Thanx,
    Ananth.

    well, that still isn't much to go off of. I give it a try though.
    I guess you want to parse out the relevent data out of the xml file and then decide on your favorite delimated file format for Excel. Two popular formats are comma delimated:
    "info1","info2","info3","info4"
    and tab delimeted:
    info <tab> info2 <tab> info3 <tab> info4
    Excel should be able to unsestand either of these formats.

  • Help needed on running a downloaded firmware file

    Hello,
    I recently downloaded new firmware to my computer for my WRT54GS Ver 6 wireless router.  It is a .bin file (whatever that is).  I cannot get it to open.  Can anyone help me?  Thanks and Happy New Year.
    Jon
    Solved!
    Go to Solution.

    Follow these steps to upgrade the firmware on the device: -
    Open an Internet Explorer browser page.In the address bar type - 192.168.1.1
    Leave username blank & in password use admin in lower case...
    Click on the 'Administration' tab- Then click on the 'Firmware Upgrade' sub tab- Here click on 'Browse' and browse the .bin firmware file that you have downloaded and click on "Upgrade"...
    Wait for few seconds until it shows that "Upgrade is successful"  After the firmware upgrade, click on "Reboot" and you will be returned back to the same page OR it will say "Page cannot be displayed".
    After the Upgrade Press and hold the reset button for 30 seconds...
    Then, unplug the power cable while holding down the reset button for another 30 Seconds...
    Plug the power cable back in, and keep holding down the reset button for another 30 Seconds...
    Release the reset button...Now re-configure your router... 

  • Help needed regarding reading in a text file and tokenizing strings.

    Hello, I require help with a task I've been set, which asks me to read in a text file, and check the contents for errors. The text file contains lines as follows.
    surname:forename:1234:01-02-06
    I can read in the file, but dont know how to split the strings so each token can be tested (ie numbers in the name tokens)
    However, I am not allowed to use regex functions, only those found in java.io.*
    I think i should be putting the tokens into an array, but have had no luck so far in doing so. Any help would be appreciated.

    public class Validator {
         public static void main(String args[]) {
              String string = "Suname:Forename:1234:01_02-06";
              String stringArray[] = string.split(":");
              System.out.println (validateLetters(stringArray[0]));//returns true
              System.out.println (validateNumbers(stringArray[3]));//returns false
         static boolean validateLetters(String s) {
                 for(int i = 0; i < s.length(); i++) {
                 char c = s.charAt(i);
                 if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) {
                         return false; //return false if one of characters is other than a-z A-Z
                 }//end if
                 }//end for
                 return true;
         }//end validateLetters
         static boolean validateNumbers(String s) {
                 for(int i = 0; i < s.length(); i++) {
                 char c = s.charAt(i);
                 if ((c < '0' || c > '9') && (c != '-')) {
                         return false; //return false if one of characters is other than 0-9 or -
                 }//end if
                 }//end for
                 return true;
         }//end validateNumbers
    }

  • HELP NEEDED - How to convert a .ram file into .aac???

    Hi
    I am downloading radio programmes and the files downloaded all have a .ram extension.
    When double clicking on the files, iTunes opens but does not put the file in the library nor plays it.
    I tried the option 'importing' and 'add to library', but no reaction from iTunes either.
    Can someone out there help???
    Thank you so much

    Mike is correct above. Use RealPlayer to play the .RAM files, and use AudioHijack to record them to AIFF or MP3.
    http://www.rogueamoeba.com/audiohijack/

  • Help needed. Can I import MTS files directly into FCE?

    I am currently using iMovie, but iMovie doesn't recognise the .MTS files that my Panasonic AG-HMC41E produces.
    I was thinking of upgrading to Final Cut Express, but I don't know if that will solve the problem or not.
    Can anybody confirm that FCE will enable me to directly import .MTS files?
    Thanks in advance,
    Mike

    As far as I have heard, transcoding to Apple Intermediate Codec (AIC) makes a file that scarcely looks different from the original MTS; I should remind you that if you were able to ingest the MTS files directly into iMovie or Final Cut Express, they will do the same thing - transcode to Apple Intermediate Codec; they're just doing it within the interface of a capturing process. When they are ready for editing, they are now AIC. An app like Streamclip or ClipWrap is just helping you get this done outside of FCE or iMovie.
    ClipWrap 2 can rewrap your mts file as a MOV and leave it untouched - quality is the same. However, FCE won't edit that without having to render a lot. It's best to transcode it to AIC.
    There is a higher quality codec than AIC, called ProRes, but only Final Cut Pro can edit this.

  • Help needed to recover migrated bookmarks

    Hi Everyone,
    I am a new Safari user (formerly a PC person). 
    I accidentally deleted the bookmarks that I migrated from my old Dell PC.  Unfortunately I did not back up my bookmarks.  Is there a way to recover them?
    Thank you.

    If the pictures on the iPad are in the camera roll and your mom has not imported them to her computer, or if she has not backed up the iPad with iCloud or iTunes, when you restore the iPad they will be erased and there is no way to save them.
    If these are photos that she synced to the iPad from iTunes, she doesn't have to worry about losing the photos because they would still have to be on her computer somewhere - since that is where she would have synced them from.
    So you need to find out if she backs up her iPad or if she did import them to the computer.
    If she has no backup and the photos are not on the computer - her choices are restore the iPad and have a working device again and lose the photos - or keep the photos on an iPad that she can't use anyway and will not be able to get the photos no matter what she does.
    Really seems like an easy choice if you think about it that way.

  • Applescript help needed: Trying to recreate this .bat file...

    Uh oh, perhaps I put this in the wrong forum:)
    http://discussions.apple.com/thread.jspa?threadID=2611596&tstart=0
    thanks!!!

    Spaces are used to delimit the commands and terms on the command line, so to use something with a space (or other characters special to the shell) you will need to escape it (by using a backslash in front of the character to escape) or put the term in quotes. Also, in order to pass parameters to the executable (I am guessing that you are passing command line parameters to the game)), you will need to use the path to the executable in the application bundle, otherwise it will get launched as a regular application.
    I don't know what the name of the executable is, but it should be located in the Contents/MacOS folder in the bundle (right-click the application and choose Show Package Contents) - you can drag file items to the Terminal window to get a properly escaped path. The command in the Terminal (or an AppleScript do shell script command) would look something like:/Applications/Games/Butt/Battlefield 1942 The Road To Rome/Contents/MacOS/theExecutableName +game XPack2or'Applications/Games/Butt/Battlefield 1942 The Road To Rome/Contents/MacOS/theExecutableName' +game XPack2

Maybe you are looking for

  • Excise duties for tooling amortization

    Dear All, Our customer paid the tooling amortization amount initially. We used to send the seperate invoice for this tooling amount. Here a doubt arises. For this scenario, do we have excise values (BED, ECS, SECESS)? Could someone confirm? Regards,

  • How can I get rid of 130+ unread texts that are actually read?

    My iPhone isn't recognizing when I have read a text message. It's up to 130 now and it's taking up all the storage on my phone. Everything is running slow and I have tried restarting and resetting my phone, closing all the apps I had open before doin

  • When will Adobe Reader for iOS support Livecycle XFA forms?

    Adobe Reader for iOS currently does not appear to support XFA forms created through Livecycle. Although it supports some field types, the HTTP submit and Email submit buttons don't work. Being able to email the completed form ready for someone else t

  • How to get Music "purchased" on iTunes on my Apple TV?

    I had no problem getting my CD music that was loaded into iTunes to appear on my Apple TV, but I could not get my music that was "purchased" from iTunes to appear on my Apple TV. I made a playlist with music that I purchased and music I loaded from m

  • What's the regex pattern for regular English chars and numbers ...

    In Java String there is a matches(String regex) method, how can I specify the regex for regular English chars, I want it to tell me if the string contains non-English chars. The string is from an email, my application wants to know if the email conta