Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: read a file word by word

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Thanked 0 Times in 0 Posts

    Default read a file word by word

    Hi all,
    I want read a xsl file and produce another xsl file with some tag replaced in it.I have tried with substring but it is not efficient that much,so i thought to read the file word by word.can anyone help me how to do it.i have given below the xsl
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0"
    <xsl:template match="mainpara">

    <xsl:template match="epigraph">

    <xsl:template match="para">

    <xsl:template match="blockquote">
    in this i need to replace a epigraph to html and html to epigraph and same like tat for other tags also.

  2. #2

    Default Re: read a file word by word

    You should read the entire file into a String and use the replace method for strings.
    String (Java Platform SE 6)
    Note that since you want to switch tags around you will need to create a temporary tag to change to and revert back

    ex: replace <b> with <i>
    //opening tags
    //closing tags
    Kenneth Walter
    Software Developer

Similar Threads

  1. Unscrambler, trying to get the last word of a dictionary...
    By csharp100 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 1st, 2011, 03:44 AM
  2. Content in text file to MS Word file help!
    By ComputerSaysNo in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: October 27th, 2011, 11:39 AM
  3. Reading a text file word by word
    By dylanka in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: October 21st, 2011, 02:06 PM
  4. MS word file in Oracle
    By tandonpiyush in forum Java Servlet
    Replies: 2
    Last Post: July 28th, 2011, 07:41 AM
  5. Word Search Help
    By Tanner in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 3rd, 2011, 01:39 AM