Eclipse provide very nice aproach to build AST tree from PHP, JavaScript and JAVA code. You can go over every each element of language recieving positions of that elements + it validate code and you have positions of syntax errors.
I tried to find similiar API for HTML and CSS but without successes. I'm sure that it exist, because Eclipse support highlighting and code assist for that languages. Will be happy to receive any advice!
Have you looked at the WebTools source editing project?
http://projects.eclipse.org/projects/webtools.sourceediting
They offer editors for CSS and HTML. The Validators are alo part of this prpject I think.
As HTML and CSS is different from programming languages, you may not get an AST similar to Java, adn the derived PHP and Javascript plugins.
Your question maybe easier to answer when you state why you need access to the AST: erro checking, automated code refactoring, ...
If you cannot find it in those projects, you can have a look at ANTLR, where you create you own language definitions, compile them to Java. These are then quite easy to put into an Eclipse Builder, so you can have access to the AST you created for the files you're editing.
I believe Eclipse for Java EE is what you want. It validates HTML code, I'm not sure about CSS
I use eclipse for php. This distribuition does edit html, css, javascript files : http://www.eclipse.org/downloads/packages/eclipse-php-developers/heliosr
JSOUP is a simple HTML/CSS parser
For CSS alone you could try the GWT CSS abstraction
Related
I have been reading this tutorial about html imports. However I became more confused after it. I'm coming from an Angular 1 & 2 background with some React recently. I have been progressing trough all the stages of javascript evolution. Using scripts in the header than require.js than system.js and now I've been doing just fine with webpack.
Reading about these imports it becomes a bit fuzzy. I don't have a clear image when to or not to use them. If webpack is used, do I still need html imports (probably for 3rd party stuff)? Certainly I love typescript and I definitely don't want to build the js artefacts myself using the command line like in the early days. I feel webpack is a must-have.
I know this question can be viewed as vague and closed, but I'm really stuck. Right now resources on web components are few and I can't manage to find my way towards a clear and confident answer.
P.S I want to use vanila components, not polymer stuff.
Some of the major browsers(i.e. Firefox) are not planning to ship HTML imports, ever.
Quoting from https://hacks.mozilla.org/2014/12/mozilla-and-web-components/
Mozilla will not ship an implementation of HTML Imports. We expect that once JavaScript modules — a feature derived from JavaScript libraries written by the developer community — is shipped, the way we look at this problem will have changed.
It will still be good to learn about the standard though, because of its unique feature of HTML parsing, which won't be possible with any representation of HTML in JS modules(which are being pioneered as replacement for HTML imports)
But for now, it seems like HTML imports are not getting anywhere, until something comes out of HTML Modules proposal, which plans to rebuild HTML Imports functionality using the ES Modules.
i have a project that has a JEditorPane in netbeans, at the moment i have this being populated with a chosen .java file. what i would like to happen do is when the java file is loaded the syntax is colored appropriately so that it is easy to read other then the current plain text it is now.
Does anybody have any ideas on how to do this as i am unable to find any good examples of this online?
EDIT: ANSWER
I got this to finally work, i added the JSyntaxPane jar file to my classpath (jsyntaxpane-0.9.5-b29.jar to be exact) then i added the following two lines of code to get it working for my JEditorPane.
jsyntaxpane.DefaultSyntaxKit.initKit();
JEditorPane.setContentType("text/java");
This can also be used on the following languages: JavaScript, Properties, Groovy, C, C++, XML, SQL, Ruby and Python... just by simply changing text/java to text/LANGUAGE_YOU_WANT in the above code
I would suggest to use RSyntaxTextArea (see http://fifesoft.com/rsyntaxtextarea/).
It's very easy to integrate and works great. The documentation contains an example, which shows how to integrate a RSyntaxtTextArea for Java-Syntax-Hightlighting:
http://fifesoft.com/rsyntaxtextarea/examples/example1.php
I came across the problem of not having an editor kit that could not handle some parts of a webpage. Examples include javascript and css. Does anyone know where I can find an editor kit that is suitable for that?
Also I'm curious as to what programming language browsers like Google Chrome and IE use.
Try Aptana Studio
There are already miscellaneous browser projects using java. The java Scripting API supporting undermore JavaScript (JS sometime named ECMAScript) will be worth looking into. You should on reading the HTML, construct a DOM tree and interprete <script> blocks, which may operate on the DOM or write HTML you have to read from.
The EditorKit in swing builds a too simple non.tree StyledDocument, which you have to bridge.
The way to proceed would be to first not use swing output but immediately generate a DOM/generated HTML.
I'm trying to put PrettyTime into JSP as a tag. Found this page - http://www.ke-cai.net/2010/03/formatting-time-with-prettytime-jsp-tag.html - as the only source of the tag. But I've never used Maven, so I can't figure out how to get that prettyTime.tag file along with the source code. Can someone suggest something or should I just go ahead and write a tag myself?
From what I can see in that article, all Maven will be doing is pulling in the java library. You can do this manually, and include it in your standard way (ie, in your "lib").
He seems to be telling you then how to write your own jsp tag (suggesting you call it "prettyTime.tag"), and then how to reference it.
Side note, you may want to consider reading up on and adopting Maven, its quite a powerful build management helper for java web app development.
That's just a blog of someone else. It's available by the manufacturer's site: http://ocpsoft.com/prettytime/
It's however a JSF tag, which means that you have to install and use JSF as well.
Instead of using a server-side component, you can use javascript. See the jQuery timeago plugin
In a web browser written in java different types of parser have been used to do the parsing and create a DOM document. In the process of rendering how the browser visualize the DOM into J-Component . Can anyone tell me about the whole process of implementing of DOM into J-Component to show the whole web-page in java ?
Here is a link where you can find how to display a DOM Hierarchy into JTree (subclass of JComponent) component:
http://download.oracle.com/docs/cd/E17802_01/j2ee/j2ee/1.4/docs/tutorial-update2/doc/JAXPDOM4.html#wp64186
Hope it will help you.
That is far too large a subject for this forum - Unless you restrict the browser to a specific version of HTML without CSS, without JavaScript (or other scripting languages) and without any embedded objects.
You could look at existing code if you can work within the GPL and other licences.
Well, basically you implement the HTML and CSS standards. Doing so completely and correctly is a HUGE amount of work, several man-years at least. There are some projects are are attempting this, but none have been very successful so far.