Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 314
  • Last Modified:

java/html: tool needed to write info into html doc

Is there a 3rd party tool (java based) that writes to a HTML file? The purpose of the HTML file is install instruction for a package.

If not can someone point me to Java code that would perform writing specifics to a HTML doc?
0
newbieal
Asked:
newbieal
  • 5
  • 4
2 Solutions
 
humanonomicsCommented:
Try nekohtml.sourceforge.net

this is used to read/wriite to and from the html files.
0
 
newbiealAuthor Commented:
I should add that the install instructions are for solaris packages
0
 
humanonomicsCommented:
I don't see any specific reason, why nekoHtml will not work on solaris. I have used it on windows, linux, unix as well as sun solaris and hp solaris.
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
newbiealAuthor Commented:
All I need is something that generates a standard html template for developers to then use and write install instructions.  It doesn't look like that this parsers does this or at least it seems to be over complicating what I'm looking for.  I just need something very simple.
0
 
humanonomicsCommented:
Can you give an example of what you need to achieve?
0
 
newbiealAuthor Commented:
Yes, I have a solaris package that contains sepcific info in a pom.xml file.  This info needs to be taken and passed to my java program and added to the <head> tag of the html document.

I've tried filewriter/bufferedwriter but that just adds info to the end of the html file.  Any code example you could give that accomplishes this would be greatly appreciated.

I thought maybe that there is already a 3rd party tool, such as possibly xml parser that could accomplish this but it seems to be more difficult, but I might be wrong as I'm not too familiar with how xml parser works.
0
 
newbiealAuthor Commented:
Would this HTML Parser help with this solution (http://htmlparser.sourceforge.net/).  If yes, how could this be added to my code to make it useful?
0
 
humanonomicsCommented:
since you want to modify an html file, you would need to do 2 things:
1) you need to read the whole HTML file (if the file is not too big in size). and then modify the contents you wish to.
2) re-write the new contents to the file.

You can achieve this with filewriter/bufferedwriter and also with nekoHTML and HTMLParser (one you pointed out to).

To see and find out how it works, you need to go through the samples they have provided, and also refer to javadocs.

I did not find time to try out html parser at my end as yet.

Thanks
0
 
newbiealAuthor Commented:
I do understand what I need to do, but am having a hard time understanding how to use the html parser with filewriter/bufferedwriter.  Could you please provide a code example?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now