Results 1 to 4 of 4
  1. #1
    mr.vinnie is offline Member
    Join Date
    Sep 2009
    Posts
    2
    Rep Power
    0

    Default How to strip out comment tags

    I want to strip out specific comment tags from html code that is dynamically generated -

    I want to add some java script to remove the comment tags - The comment tags are always the same and do not change -

    ie;

    <!--my comment tags-->

    Any help would be appreciated to strip these tags from the end user source code

    Thanks

  2. #2
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    Java is not at all the same as javascript...
    My Hobby Project: LegacyClone

  3. #3
    mr.vinnie is offline Member
    Join Date
    Sep 2009
    Posts
    2
    Rep Power
    0

    Default

    Yes, I thought I might find some help here -

  4. #4
    CodesAway's Avatar
    CodesAway is offline Senior Member
    Join Date
    Sep 2009
    Location
    Texas
    Posts
    238
    Rep Power
    5

    Default

    If you want a java program to do this, I have an idea, since I did something like this recently.

    1) Use a BufferedReader to read the file, line by line
    2) Use a StringBuilder object to store the "new" file
    3) For each line, if you want to keep it, append it to the StringBuilder object;
    if you don't want it, continue
    (Modify the line as needed in this step)

    4) After you have read the entire file, close the BufferedReader, calling the close method
    5) Open a BufferedWriter with the same file name
    6) Write the StringBuilder object to the file (via the BufferedWriter)
    7) Close the BufferedWriter

    Now, the file contains the same text, but with the modifications.
    CodesAway - codesaway.info
    writing tools that make writing code a little easier

Similar Threads

  1. URL/comment problem
    By Chasingxsuns in forum New To Java
    Replies: 4
    Last Post: 07-25-2009, 03:10 AM
  2. How do I strip down integers for future manipulation?
    By frasifrasi in forum New To Java
    Replies: 12
    Last Post: 06-14-2008, 02:17 AM
  3. About Comment By Using SAX
    By tapas in forum XML
    Replies: 1
    Last Post: 01-24-2008, 05:29 AM
  4. Help with Tags JSP
    By Marcus in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-04-2007, 02:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •