Posts tagged as:
XStream
Daily del.icio.us for February 10th through February 14th
- Zimbra's new Desktop: Look ma, no browser! | The Open Road - The Business and Politics of Open Source by Matt Asay - CNET Blogs - It's very cool. You should give it a spin. This is the best e-mail "client" ever built…largely because of its successful marriage of the Web with the desktop. In the future, all applications will be like this–or should be.
- Ext Road Map - Our goals for 2008 are to continue improving the 2.x version line by adding new components and enhancing some of the existing areas of functionality in Ext as shown below. Looking ahead to 3.0, there are some big new areas that we'll be getting into. In a
- The Making of MarkMail: Announcing an Informal Partnership with Codehaus - We're happy to announce we've developed an informal partnership with Codehaus to load all their mail archives and receive automatic notification of new Codehaus lists as they get created.
- A Conversation with Matt Mullenweg (Yahoo! Developer Network blog) - A few weeks ago, Matt Mullenweg (creator of WordPress) came by Yahoo to talk to a bunch of Yahoo! bloggers about the current and future state of WordPress. After the meeting, I sat down with him for our Developer Spotlight series on YDN Theater to catch u
- Andres Almiray's Weblog : Weblog - JSON-lib is a java library for transforming beans, maps and XML to JSON and back again to beans and DynaBeans. It is based on the work by Douglas Crockford in http://www.json.org/java.
- The State of BPM: Top-Five Trends | The Intelligent Enterprise Blog - The results show a number of interesting trends indicating that CIOs and business leaders are focused on improving their processes. Existing customers described how they expect to get their ROI from their BPM implementations, and most expect to see ROI ov
- Starbucks ditches T-Mobile for AT&T | Crave : The gadget blog - The new AT&T plan allows all customers 2 free hours per day, with a $3.99 fee for additional 2-hour chunks of time. Monthly subscriptions will cost $19.99 and will enable access to other AT&T hot-spot locations in addition to Starbucks.
- Anthony Park :: 100% Geek Content by Volume » New Vista Media Center Plugin - MyNetflix (beta) - I’ve kept this pretty quiet, but I’ve been working on a new Media Center plugin for a little while now. It is now ready for beta testing, and I’ve decided to run a public beta for this one. MyNetflix features * View your Netflix queue * Browse movie
- Humanized > Our Products > Enso Launcher - Enso Launcher is designed to give you instant access to your applications and windows. With a few easily remembered keystrokes, you can launch an application, switch to a window by name, and control the state of your windows.
- Martin Wolf : Advanced Java 5 Generics - Here's an article about a few of the more subtle aspects of Java 5 Generics. This is hardly the 1st article about this particular subject, but none of them explain it quite the way I would have wanted to see it when I was wrestling with this issue myself.
- Panopticon: The Power of Pre-Attentive Processing - Our visualization software is easy to use and is a great way to explore large datasets, identify outliers and find hidden patterns.
Related posts
{ 0 comments }
Daily del.icio.us for May 25, 2007
- Flex.org - Flex for Java Developers - Flex.org has a new (new to me anyways) resource - Flex for Java Developers
- Sarbanes-Oxley Audit Rules To Ease; Bad For IT Spending; Good For Corporate Earnings - On Wednesday, the SEC approved new guidance for how to implement Section 404.
- Haus News - XStream 1.2.2 released - The XStream Development Team is proud to present XStream 1.2.1. XStream is a simple library to serialize objects to XML and back again.
- Ajaxian - ProtoPacked 2.13: Protoype + Script.aculo.us == 32kb - This updated pack includes compressed versions of Prototype: 1.4, 1.5, 1.5.1 and Scriptaculous: 1.7.1_beta2. There is also a ?Protoculous? option as well (Prototype and Scriptaculous combined)
- Ajaxian - Interface Elements for jQuery - Interface Elements is to jQuery, as Script.aculo.us is to Prototype.
Related posts
Daily del.icio.us for May 22, 2007 through May 25, 2007
- Flex.org - Flex for Java Developers - Flex.org has a new (new to me anyways) resource - Flex for Java Developers
- Sarbanes-Oxley Audit Rules To Ease; Bad For IT Spending; Good For Corporate Earnings - On Wednesday, the SEC approved new guidance for how to implement Section 404.
- Haus News - XStream 1.2.2 released - The XStream Development Team is proud to present XStream 1.2.1. XStream is a simple library to serialize objects to XML and back again.
- Ajaxian - ProtoPacked 2.13: Protoype + Script.aculo.us == 32kb - This updated pack includes compressed versions of Prototype: 1.4, 1.5, 1.5.1 and Scriptaculous: 1.7.1_beta2. There is also a ?Protoculous? option as well (Prototype and Scriptaculous combined)
- Ajaxian - Interface Elements for jQuery - Interface Elements is to jQuery, as Script.aculo.us is to Prototype.
- GPL author: Google must share code | InfoWorld | News | 2007-05-23 | By Robert McMillan, IDG News Service - Companies like Google that build their business on software such as Linux have a moral imperative to contribute back to the free software community, a prominent open-source advocate said Tuesday.
- reviewboard - Google Code - Review Board is a web-based tool designed to help projects and companies keep track of pending code changes and make code reviews much less painful and time-consuming
- Tabbed Navigation Using CSS - This tutorial will teach you how to create low-bandwidth tab navigation on a web page using CSS. As an extra bonus you'll also learn how to switch tabs without loading the page more than once.
Related posts
Declarative Caching Services for Spring
Declarative Caching Services for Spring by Alex Ruiz — Caching is an essential practice that improves the performance of enterprise applications. In this article, Alex Ruiz demonstrates a declarative caching framework for Spring 2.0, which supports pluggable cache implementations.
Related posts
Life is beautiful with XMLBeans and XStream
XML creation, parsing and processing with Java has gotten so much easier with tools like XMLBeans, XStream and many other such tools. I personally love XMLBeans and XStream and I try to use them for all of my XML processing needs. While they both consume XML, they solve different problems. XMLBeans allows you to process XML by binding it to Java types using XML schema that has been compiled to generate Java types that represent schema types. XStream on the other hand allows you to serialize objects to XML and back again using special reflective secret sauce.
I've been using these tools for many years now and so you tend to forget just how useful and powerful they are and how productive they make you. Case in point – A friend of mine came to me for help. He was building an application that would allow him to resale items from Amazon on his site and he wanted to use the Amazon eCommerce Web Services to search for products programmatically and update a local database that housed his content. Having played with Amazon E-Commerce Service (ECS) before, I offered to write up a simple application that would make the Web Services call, process the results and present them back to you.
Amazon's ECS is an API that allows you to access Amazon data and functionality through a Web site or Web-enabled application. ECS follows the standard Web services model: users of the service request data through XML over HTTP (REST) or SOAP and data is returned by the service as an XML-formatted stream of text. In addition to the WSDL, ECS also provides XML schemas for validating the XML output of REST requests. So I decide to use XMLBeans to create my type system using the XML Schema provided by Amazon. XMLBeans provides you with a utility (scomp) to compile your schema into Java XMLBeans classes and metadata. To generate the Java code, use the following command:
scomp –jar amznws.jar AWSECommerceService.xsd
This generates a jar file named amznws.jar, which will contain all of the code needed to bind an XML instance to the Java types representing your schema. In my application, I use HttpClient to make my REST request and then use the XMLBeans generated jar file to process the result. Here's a snippet of code from my sample class:
[code lang="java"]
if (StringUtils.isNotBlank(searchCriteria)) {
String url = "http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&" +
"AWSAccessKeyId=*YOUR_KEY*&AssociateTag=*YOUR_TAG*&Operation=ItemSearch&SearchIndex=Books&" +
"Keywords=" + searchCriteria + "&ResponseGroup=Large,Images";
GetMethod method = new GetMethod(url);
List
try {
int statusCode = client.executeMethod(method);
if (statusCode != HttpStatus.SC_OK) {
log.error("Method failed: " + method.getStatusLine());
}
// Read the response body.
InputStream in = method.getResponseBodyAsStream();
String xmlPayload = parseISToString(in);
// Set up the validation error listener.
ArrayList validationErrors = new ArrayList();
XmlOptions validationOptions = new XmlOptions();
validationOptions.setErrorListener(validationErrors);
ItemSearchResponseDocument items = ItemSearchResponseDocument.Factory.parse(xmlPayload);
if (items != null) {
ItemsDocument.Items[] itemsArray = items.getItemSearchResponse().getItemsArray();
for (int i = 0; i < itemsArray.length; i++) {
AmazonWSObject amzn = processResults(itemsArray, i);
results.add(i, amzn);
}
// During validation, errors are added to the ArrayList
boolean isValid = items.validate(validationOptions);
// Print the errors if the XML is invalid.
if (!isValid) {
for (Object validationError : validationErrors) {
log.error(">> " + validationError + "\n");
}
}
} else {
log.error("Search returned no results");
}
} catch (HttpException e) {
log.error("Fatal protocol violation: " + e.getMessage());
} catch (IOException e) {
log.error("Fatal transport error: " + e.getMessage());
log.error(e.toString());
} catch (XmlException e) {
log.error(e.toString());
} finally {
method.releaseConnection();
}
return results;
} else {
return null;
}
[/code]
As you can tell, HttpClient makes the REST call a snap and XMLBeans makes processing the results easy as well. In total, I spent 3-4 hours getting the application working and a lot of the time was spent figuring out the data set returned from Amazon and trying to come up with a meaningful example. Here is a zip file with the IDEA project that has all the stuff needed to make this work including a simple JSP and a JUnit test class.
Links of Interest:
- Amazon Web Services
- Amazon ECS WSDL
- Amazon ECS XML Schema
- Localized editions of xsd and wsdl
- XMLBeans
- XStream
- HttpClient
Related posts