GUI for generating XML - java

Does anybody know of GUIs for generating XMLs? This means the user will not be presented with an IDE with support for XML for him to type XML codes. This would be helpful for non-technical people using the system.
I know this sounds easy, given many libraries that can help in generating XMLs. The issue here is that the schema is really that flexible rather than being straightforward like representing books in a library with their properties.
Imagine HTML, where we can create font tags inside a body, a table, a div, or nested even within itself. The solution is a WYSIWYG application that allows user to generate html codes (XML). However, that is good for XML applied in webpages since they involve visual aspect and design. My application of XML would focus on representing some conceptual and computational definitions, much like sql-like syntax, but more than that.
I'm actually after the approach or previous works done or tried, although having a library/working framework for that would be better. Btw, I'm using Java for this project. Currently, I'm just thinking of presenting element tags where user will be able to drag and drop them and nest them with each other. And perhaps, assist them through forms in inputing values for XML attributes. I'm still hoping if there are better ideas from the community.
Thank you.

I think you need to separate the eventual representation (XML) from the abstraction presented to your users. Is your information presented to the user in tree form? If not, do what is convenient for the users and sweat the XML conversion yourself.
There are many tree-based editors that use "meaningful tiles and icons" instead of XML. For example, look at how Eclipse's plug-in editor does the extension of existing points. You get a tree view and can add properties (typically in a separate group box). But you could write a smarter editor that has everything in the tree.
On the other hand, sometimes the XML representation should really be hidden despite its flexibility. A good example is the plugin.xml for Eclipse-plugins. Look at how the editor for that file looks nothing like XML. It is structured logically for the needs of the user, and the code in the background generates the XML.

I looked for this exact thing a couple of months ago. The only one I found was at http://www.jaxfront.org/pages/. It is Java based.
Note that I ended up going with Actipro Software's SyntaxEditor for .NET WinForms which, although does not give me a GUI, gives the app good IntelliSense-like prompting (derived from an underlying XSD) when editing XML.

The W3C answer to your question is XForms. Unfortunately XForms is not directly supported by browsers, although there is a Mozilla plug-in (show and edit even local files, but only in Mozilla). Many XForms solutions are available, an interesting and free one is XSLTForms (http://sourceforge.net/projects/xsltforms/) which translates XForms into HTML Forms (works with every major browser, but local files can only be shown, not edited due to the limitations of Javascript).
Also take a look on Altova Authentic.

I know it is sometimes hard for non technical people to get familiar with a tool like eclipse, but it comes with very good and easy to use XML editors. Supporting auto-completion, validation, verification. I am not sure if there is a pre configured eclipse derivate which is focused on xml editing, but you could configure such a thing quite easily.

Related

Parsing MediaWiki text in Java reliably (according to stated criteria)

I'm trying to find an API so that I can avoid building something (in Java) that can convert MediaWiki syntax to HTML myself. This seems to be a sufficiently general problem that someone else should have solved it, but thus far I've been digging around on the internet with no luck.
My first pick was Mylyn Wikitext, which seems to work somewhat, but I'm using Maven, and the Maven repository version is still 0.94, and it seems to only support a subset of the full Mediawiki syntax -- in particular, it is missing the ability to replace {{quote|sample quote text}} with blockquotes.
I also tried Bliki v3.0.19, and it also seems to be missing blockquotes.
Based on a quick survey, many of the other available options look like they are either no longer maintained, still in alpha (e.g. Sweble), or like they are projects with a single contributor, so they may be less likely to be bug-free.
So, does anyone know of a Java library for parsing MediaWiki and generating HTML that meets the following criteria? (My intent is to be specific and concrete about what I'm looking for, so it's more a binary choice than a matter of opinion.)
Still maintained -- to be more specific, it's been updated within the last two years
Actually supports Mediawiki {{quote}} syntax in addition to more standard markup like bold/italics/lists/links
More than one contributor to source code and at least hundreds of users (as evidence that most bugs and performance issues are likely to have been worked out)
Latest versions are available from the central Maven repository.
Extra credit would go to an API where the parsing language is easily extensible, and where elements of the language can also be removed.
Thanks!
https://www.mediawiki.org/wiki/Alternative_parsers lists such attempts, but none can fulfill your requirements, i.e. being able to parse site-specific markup like an individual template.
The parsing API used via Java clients is likely to be your best chance. If for some reason you cannot rely on HTTP requests, please clarify your use case in the question.

Java source code editor as an Eclipse view

I have defined an EMF metamodel in which some elements have a String field which will contain some Java code.
I am trying to create/reuse a (Java) source code editor as part of the tabbed properties view to be able to edit that field with some IDE-like functionality. It would be great to adapt the JDT editor to use it here, but for I have read, it is not feasible. Extending org.eclipse.swt.widgets.Text to provide all that functionality seems to be too much of an overkill for this simple project.
Therefore, the question would be, which approach would you recommend as the best functionality/effort ratio to achieve this?, do you now of any source code editor which may be reusable as/within a view?
Buddy...
This is really going to be a hard task.
Re-Using EditorParts in SWT widgets/ViewParts is not easy. The only thing that I got to manage was to reuse the EPF RichText-Widget which was designed for use as an EditorPart.
In that case it was easy, because it only needed an IEditorSite as a constructor parameter. I then extended it and adapted the IViewSite to an IEditorSite.
But concerning JDT: There is so much funcionality which is directly related to the Base-Text-Editor functionality from eclipses IEditorParts... I think it won't be worth the effort.
Could't you find a Java-IDE for Java-Code? Isn't there anything working with Swing/AWT?
You could then possibly include a Source-Code-Editor-Swing-Frame using a SWT_AWT-Brigde-Widget. This way I successfully integrated an Swing-PDF-Viewer into an eclipse ViewPart.
Take a look at the eclipse API desciption.
And as a first rough try for the Java IDE:
drJava
I have done a lot of work with modeling and code generation and this problem has never really been solved satisfactorily. There are many in the Model-to-Text community that argue that code should not be in the model for this and other reasons.
My approach in the past has instead been to generate my code from the model leaving comment-bracketed regions for the developer to enter their business logic and other code snippets directly into the generated code using their favorite editor. If the model changes and the code is regenerated, the developer-supplied code is retained. This also has the benefit of supporting any language (Java, C, Objective-C, JSP/HTML, etc.) and for defaulting to an appropriate default stub of generated code.
Look at the <c:userRegion> tag in Eclipse M2T-JET as an example. I believe the other Eclipse Model-to-Text technologies have similar functions.

i18n in build process (or compiling one template HTML to i18n HTMLs)

i'm working on a project which needs to support internationalization.
the solution we thought of is:
create HTML templates with placeholders for language (i.e. home.html).
create an i18n directory with files such as: "language_en_GB.json".
on the build process have them merged together to create an output HTML. the output file will sit on a language based directory (such as "views/en_GB/home.html" or "views/fr_CA/home.html").
so basically this:
<h1>{{i18n_welcome}}</h1>
<h2>{{userName}}</h2>
merged with this:
{
welcome:"Welcome!"
}
will become this during a build proccess:
<h1>Welcome!</h1>
<h1>{{userName}}</h1>
i have a few question and appriciate your input.
is this a good approach for i18n?
do you know of a templating engine that does that i18n process well?
is there a solution for client side "baking". i would like a UI developer to be able to bake localy as well.
There are several frameworks that support i18n out of the box depending on your needs and what you are currently using in your code. As a pure templating engine, you can take a look at Velocity or Freemarker. For a more complete framework, you can look at Spring and Spring example and Struts and Struts2 example.
There are, of course, numerous other options as well. I'm just listing four of the most popular that I've seen people use.
Basically, for any of the frameworks, you create resource bundles for each language (named using the language for the specific bundle. Ex: language_en_GB.properties). So your thought process is pretty much in line. Basically you start with your html file and include your placeholder. In your resource bundle for each language, you specify what the string is supposed to be. After that, the framework does the merging on the fly for you, using the appropriate resource bundle for the language in question.
So you're pretty much on the right track - it all becomes a question of integrating properly with your framework and leveraging it to do the merging instead of doing it during your build pipeline.
You failed to provide the necessary details, so I can't really answer your question. I can only say that what you plan seems to be another wheel re-invention (but not as round as original one).
There are certain i18n best practices. In Java world it usually mean using Resource Bundles (in form of properties files) and some mechanism like JSTL to translate them when the page is being rendered. This is the best approach, as you won't need to re-compile anything to introduce the support for another language.
If you care about providing support for client-side scripts, it is usually done by writing out some array from the web page and accessing it on the client side. I think this is the most common solution. Another would be having some web service to provide you with translations and read it via XHR (i.e. AJAX), but that may be problematic. Anyway, you need to push the translations from the server side to the client side somehow.
And of course you need to read them from resource bundles.
From what you wrote it seems that you want to build some kind of static web page, backed by the application server (thus static web pages compilation). If I guessed correctly, honestly using Java for it is a bit overkill. You'd better go with some CMS software like Joomla, Drupal or jEase.

Create HTML Reports with JBoss?

Are there any libraries (built-in or third party) for writing .html reports with JBoss apps quickly and easily?
I have a list of entities in a database that I want to display in different tables. There will need to be things like links within the report to go from some parts of the report to other parts, sorting/paging, and some nice CSS to make the report pretty would be nice.
I have an existing application that produces the .html and .css programmatically, but due to the huge size of the data (124Mb in some cases), the writing of the .html takes way too long (40+ minutes) and often freezes up the browser. So I am looking for an alternative.
I guess one solution is to write JSF forms that fill rich tables with bean data, but I am not sure if this is the best approach.
Replies highly valued! Thanks
Have you looked into JQuery? It offers large number of plug-ins to achive pagination, tables, sorting etc. and it sound like it might be a good fit for your case.
JasperReports is open source, flexible, and perfect for my needs (I am reporting using xml data, and a simple transformation will be perfect to JSXML format to produce reports in this way).

Java Internationalization (i18n) Libraries/Frameworks

My organisation is about to embark on the long process of internationalizing (i16g?) its corporate website. The website is a mix of Java EE (JSP/Servlets, no EJB) and static content pushed from the (Documentum) WCM.
While I have experience using the "built-in" mechanism of using ResourceBundle's along with the associated properties files for each language/locale (containing the "KEY=Translated value" approach), where we simply reference the KEY value where we want the translated text to appear.
My director has mentioned that he has used a different approach at a previous organisation whereby they used a 3rd-party library (he does not recall the actual name) which included the actual [english] text in the webpage (to aid developers) which was replaced at run time with the translated content from the config xml file. (anyone know which library this would be?)
I am interested in what other approaches/libraries/frameworks there might be out there to facilitate this.
Thanks
Your boss probably meant gettext, just like #Pawel Dyda mentioned, but cosmopolitan may also be of interest to you.
My company also maintains a GNU gettext-related library for Java (and very soon with extensions aimed at Scala).
Not only does it support all of the goodness of GNU gettext, it also simplifies output AND input of date/timestamps and currency, include facilities for using "wiki" formatting in translations (so you can output HTML bold on a word, for example), java message formatting, generalized "escape" support (so the output can be auto-escaped for inclusion, say, in HTML), and currency rounding.
It is open-source, and currently on github at https://github.com/awkay/easy-i18n/
When I hear you are using ResourceBundles, I see something like this:
ResourceBundle rb = ResourceBundle.getBundle("messages", locale);
String someString = rb.getString("some.key");
If this is your approach for Java Server Pages (using such snippets in scriplets), this is wrong. Instead, you should use JSTL or Spring message tags.
As for your inquiry, I believe they used Gettext (sorry no link, as I am running out of time).
This is not necessary the best approach. JSTL approach is the most common for JSP and you should stick to it, unless you have very good reasons not to.
It worth looking at http://alexsexton.com/blog/2012/03/the-ux-of-language/ it has a good explanation of the idea behind gettext and the limitations of the gettext design a better approach to gettext is the ICU message format this is what the JDK MessageFormat class is based, on http://site.icu-project.org/home there is also a javascript library based on the ICU message format https://github.com/SlexAxton/messageformat.js
I hope, it's not too late to suggest one more solution: https://github.com/resource4j/resource4j
This library has integration with Thymeleaf web page renderer, which solves the problem you've mentioned: you include in page template the English text and then substitute it with localized version in runtime.

Categories

Resources