Skip to Content

Bjarne Hansen's blog

JAXB @XmlElementWrapper Plugin (new release)

The XmlElementWrapper plugin for JAXB xjc has been updated based on feedback from a number of users.

For information about the XmlElementWrapper plugin, what it does and how it work, please refer to the JAXB @XmlElementWrapper Plugin... blog entry.

To download the latest version of the XmlElementWrapper plugin, please visit the projects page. I've finally found the time to install and configure Hudson to build and distribute release versions of the code, so any upcoming releases will automatically be distributed to the projects page.

As always, if you have comments/suggestions please feel free to use the contact form to submit a mail to me.

Using Eclipse for Developing SAP XI User Defined Functions

When creating User Defined Functions (UDFs) in SAP XI, the editor for entering the Java source code is merely a plain text box. Being used to develop Java code using Eclipse, this feels like being back in the Dark Ages, missing simple things like code completion etc.

Also, simple syntax and programming errors takes a fair number of editing/saving/executing/wondering/editing/... cycles in SAP XI to get a working function in place, and the runtime errors reported by SAP XI may not always lead you on the right path, as the code you enter is compiled together in a class resulting in severely misaligned line numbers.

A much more joyful approach is to develop the UDFs using the SAP NetWeaver Development Infrastructure, or to use the freely available Eclipse IDE to do development and testing before pasting the final result into the plain text box of SAP XI. Also, if you are developing UDFs that are more than a couple of lines, a better approach will be to build a complete JAR file with your UDF and reference it from within SAP XI.

This article describes a small foundation for a SAP XI UDF Workbench that can be used to develop, test, and build SAP XI User Defined Functions using Eclipse.

JAXB @XmlElementWrapper Plugin...

When generating XML schema from Java source code using the schemagen tool a common approach is to use the @XmlElementWrapper and @XmlElement annotations to handle schema generation for collections. However, when generating Java source from a schema using the xjc tool the resulting code is not created with these annotations. Instead, the generated Java source contains "injected" inner classes to accommodate the collection of elements contained within an element.

To solve this small - but to me rather annoying - problem I've created a simple JAXB compiler plugin doing a "rewrite" of the default code generated using the xjc tool. The "rewritten" code will be straight forward and simple, and will have the @XmlElementWrapper and @XmlElement annotations around the collection fields.

If You can Measure It...

Recently I was looking into doing a number of conversions between different units of measurements. This was when I stumbled upon the web site "How Many? - A Dictionary of Units of Measurements".

The site contains the usual known units of measurements - and how to convert between them - but it also contains a lot of other exciting information such as the Glasgow coma scale, Hat sizes, and Shotgun gauges.

Furthermore, I found a consolidated list of ISO country codes along with the corresponding IANA, IOC, and ITU country codes, which may come in handy some day.

Finally, there is a very interesting section on the English Customary Weights and Measures that explains some of the more exotic names for weights and measures (and their origin) used in England.

Syndicate content