I am attending the Colorado Software Summit in Keystone, Colorado. I went to the presentation by Mark Reinhold titled "Tigers, Mustangs, and Dolphins, oh my". He gave information about what will be included in the Mustang release of java. One item on the slate is Language-Level XML. This is going to be gross, take a look at this code sample.
void addUser(Element element, String user, String password) {
element.add(
<account>
<user>{user}</user>
<password>{password}</password>
</account>);
}
I did type this correctly. There will be XML literals in the language.
A long time ago when JSP was introduced you could include java scriptlets into the JSP page. Then some smart people decided to ask why are we mixing HTML with java code? Then java web develeopers started working with MVC web frameworks which separated everything and that worked well. Now the powers that be, want to bring XML in java and it is my opinion that something like this will fall flat on it's face just the way that that JSP scriptlets are admonished today.
Thu, 27 Oct 2005 06:27 PM GMT
What would be cool if all of this crap automatically produce SAX or better StAX API...
Thu, 27 Oct 2005 06:38 PM GMT
I had a chance to speak with Mark last week; apparently we had the same exact presentation. Just to clarify, the in-line XML is being bandied about for Dolphin, not for Mustang. God forbid, however, if Sun/JCP actually decide to go foward with this. The adoption (or lack of it) will be driven by customer demand. This is not even a prototype (according to Mark) at this point, so there's really nothing to see. In fact, I'd say that they're testing the waters through this presentation to see what people's responses are. Cheers, pr3d4t0r, ##java / irc.freenode.net
Fri, 28 Oct 2005 01:39 AM GMT
Today with suitable classes, you could write that code as:
void addUser(Element element, String user, String password) { element.add( account( user(user), password(password) ) ); }To me that looks better and doesn't require any changes to the language (beyond 1.5), even if I wanted to commit such a crime.
Fri, 28 Oct 2005 06:16 PM GMT
Where is the classes "account", "user" and "password" declared? Wouldn't you need to inclde that to make a fair comparison?
Fri, 28 Oct 2005 08:51 AM GMT
Tom, But that classes are not general and most be generated in some way (e.g. the user and password methods). Having said that, I'm not also a fan of making the syntax of Java more complex.
Fri, 28 Oct 2005 01:31 PM GMT
This is it? and this? Gosling seems doesn't like this.
Fri, 28 Oct 2005 02:51 PM GMT
Oh brother. Is is sooo MS (I'm thinking of VB and .NET) - every clutch, crutch and bad design gets marketed as "enabling the developer to get things done faster". I believe in the UNIX way of doing things: rather plug cleanly cut components together to produce an application (such as grep, awk, sed, cat, find etc. on the command line) than program a new application for each new task. XML is grossly overrated anyway (ASN.1 and BER would be a much more compact alternative), and should not be honored by becoming an integral part of Java, cluttering up the language.