I would like to generate static HTML5 pages, defining my own tags and rendering more complex HTML in the generated pages.
I like the polymer architecture approach to define new sets of tags.
When I want to generate my pages, I'm not in a browser, so I can use Java or NodeJS engines to compute the final HTML pages (from a console for instance).
To sum up, I want to define my own tag libraries using the polymer approach, code some HTML using those new tags, and "print" the result DOM in a static HTML file, running all that from a console program (using Java or NodeJS).
Does somebody know how to do so?
It seems I must have some DOM interpreters, and I know that in Java I can use jsoup, but it will probably lack some JavaScript interpreter? Can NodeJS do that more simply?
Related
In a project I'm working on, we're using BIRT to generate some HTML reports from some XML Traces.
However these reports are pretty simple and ugly and we wish to improve them. We made a mockup/template in HTML/CSS (and some JavaScript that we want to be embedded in each reports) but now that we're happy with the design, there seem to be a problem (that we should have seen before):
Can we use this template with BIRT? AFAIK, we have to design the birt template using birt's tools ; and it'll be a lot of (useless) work to do so, and we're not even sure we'll be able to obtain the same design with birt as we tweaked things very tightly with CSS.
You can give bookmarks to all of your visualizations in the BIRT report and then use the JavaScript API to display the content in your template. Alternatively, if you are building even the visualization in the HTML template, you can use the REST API to extract data into JSON format and then visualize that as you like in your HTML pages.
You could also load the external CSS file with the BIRT report.
I need to grab the whole HTML from a web page included dynamically generated HTML. Is it possible in JAVA or in PHP?
When I Inspect element with firebug it shows whole HTML. but when I use java I get only static HTML file.
I am displaying few tables using HTML table tag and CSS . I am using Struts 2 and would like to include the "Export to PDF" functionality. Right now its just one page where i have to use this. Later one there will be one or two more page where i have to use this feature. I am Looking for some easy to implement available plugins or jar or anything that can be used to do that.
There is a Java API for generating PDF.
Here it is: http://itextpdf.com/download.php
Call it from you Servlet or Struts Action, and use HttpServletRersponse.getOutputStream to direct the PDF document back to the browser.
I am working on building a web browser in Java. I have used a parser (JTIDY) to parse the HTML page into a DOM document. I know that rendering means the graphical representation of DOM document. But I don't know what the engineering process is for HTML rendering in Java. In Java there is a JEditorkit to parse and render, but it is not well-formed. So I want a better solution.
My question is: what is the actual process of HTML rendering and showing the complete web page in Java?
You can try either the Cobra renderer & parser or Flying Saucer project.
There is the pretty much vaporware JWebPane that is part of JavaFX, but who knows when and if that will ever come out.
You can use MozSwing which integrates the Mozilla rendering framework with the Java Swing toolkit.
in my GWT application, on the client side I have a string containing html. Is there a good way to go about parsing that and finding specific html tags within it and returning the id's of those tags?
Any help would be much appreciated, thanks!
Check out GWT query. It is a jQuery like API for GWT that allows easily traversing and manipulating HTML.
You could attach your HTML string to the DOM - using Element.setInnerHTML(yourString). That way you're using the browser's parser. Attaching it to an invisible element or an invisible iframe should hide whats happening from the user.
For the querying you can use GWT's DOM functions if you want to stick with plain GWT. Using JavaScript directly or any JavaScript library like jQuery are also options. GWT query might also be an option, but I haven't used that yet.
UPDATE:
This approach can be abused by XSS (cross site scripting) attacks - so you must either trust or sanitize the HTML string.