Thursday, August 07, 2008

Jaxb Multiple namespace definitions

I was mildly concerned about the number of namespace definitions that Jaxb was printing every time it marshaleld an Xml document.

I'm using Spring-ws with jaxb bindings. In my definition of the Spring Marshaller I declare the jaxb packages which this marshaller will marshall. Each of these is turned into a namespace definiton on the resulting xml doc.

<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="contextPath" value="">

Results in

<ns1:request ns1="" ns2="" ns3="" ns4="">

This was mildly irritating.

After a bit of searching I find its a 'performance feature' in Jaxb2

So they won't be fixing it.

The alternative from my point of view is to declare multiple marshallers, and use them where appropriate.

<bean id="jaxb2Marshaller1" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="contextPath" value="">
<bean id="jaxb2Marshaller2" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="contextPath" value="">

Tuesday, August 05, 2008

Python gotcha

This Seemingly innocuous indentation error in python was annoying me.

Problem invoking WLST - Traceback (innermost last):
(no code object) at line 0
File "C:\apps\", line 249
toDeploy = sys.argv[3]
SyntaxError: inconsistent dedent

Looking at my code (wlst code to auto deploy application into weblogic server), it was all indented correctly.

Well of course the computer was right. It wasn't indented correctly, but it was no obvious.

The issue was some copy and paste code I took from the internet.

It was indented using spaces, whereas I was using tabs.

Replacing the space indentation with tabs fixed the issue (but its not obvious uinless you set your editor to display non visible characters.