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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 8 of 8

Thread: Insertion of html code at a particular position

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Insertion of html code at a particular position

    Hi,

    I have to insert certain lines of html code in already existing file of html using java.I have to add certain things in head and some things in body.Can u help me??
    Regards
    Vasavi.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Insertion of html code at a particular position

    We can try to help you. Post the code you are working on and explain what the problem with it is.
    Post some samples of what the program does now to show the problem you are having with it.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Insertion of html code at a particular position

    can u plz relpy me asap

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Insertion of html code at a particular position

    What have you tried?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Insertion of html code at a particular position

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8" />
    <title>
    </title>
    </head>
    <body>

    <div class="stl_06"><span class="stl_05">Chrome 30 and higher, and I.E. 9.0 and higher. </span></div>
    </body>
    </html>


    I want to add some more tags in head and body part, using java.In java i am parsing the html file using html parser and i want to add html code from here.How can I add html at particular position

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Insertion of html code at a particular position

    Please post the code you are having problems with.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Insertion of html code at a particular position

    nodeTextTagNode) node).toTagHtml();
    try
    {
    File f=new File("/Users/Channels/Desktop/Vasavi/untitled folder/HtmlExtractor/TestHtml/LiveFile.html");
    fw=new FileWriter(f,true);
    bw=new BufferedWriter(fw);
    if(nodeText.equalsIgnoreCase("<head>"))
    {

    String data="<hello>";
    bw.write(data);

    }
    When i am adding like this it is added in the last of my html page but i want to add it in the head.nodeText conatins all the tags in my html.

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Insertion of html code at a particular position

    i want to add it in the head.nodeText conatins all the tags in my html
    What is the head.nodeText? What package and classes is that in? Does its API doc have methods that do what you want to do?

    Can you post complete code that compiles, executes and shows the problem?
    Be sure to wrap your code with code tags:
    [code=java]
    YOUR CODE GOES HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 0
    Last Post: July 2nd, 2014, 09:53 PM
  2. Converting Insertion Sort pseudocode to running Java code
    By MarkDavisCode in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 30th, 2013, 10:45 PM
  3. Replies: 6
    Last Post: March 1st, 2013, 02:06 PM
  4. output to a specific location in html code
    By aketr in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 15th, 2011, 11:44 AM
  5. Pseudo code of insertion sort linked list
    By sungirl in forum Algorithms & Recursion
    Replies: 1
    Last Post: May 23rd, 2010, 09:25 AM

Tags for this Thread