Robert Koberg | 13 Aug 19:57 2009
Picon

Re: XSLT/JAXB exception

How are you setting saxon to be your XSL processor?

-Rob

On Aug 13, 2009, at 9:58 AM, Nord, James wrote:

> HI all,
>
> I have a Linux only issue with an XLST Transform and JAX-B. The same  
> code runs fine on Windows XP (sun 32bit JDK 1.6.0_16 in both cases)
>    TransformerFactory factory = TransformerFactory.newInstance();
>    template = factory.newTemplates(xsltFile); // this is an actual  
> java.io.File
>    Transformer transformer = template.newTransformer();
>    Document dom = ... // obtain w3C DOM
>
>    JAXBResult result = new  
> JAXBResult(JAXBContext.newInstance(Catalogue.class)); //Catalogue is  
> a JAXB generated class
>
>    transformer.transform(new DOMSource(dom), result);
>    return (Catalogue) result.getResult();
>
> this results in the attached exception when run on Linux only  
> (Windows completes this without issue).
>
> However If I modify the code to go via an intermediate w3c DOM as  
> follows then it works on both windows and Linux.
>
>    TransformerFactory factory = TransformerFactory.newInstance();
(Continue reading)

Michael Kay | 14 Aug 13:23 2009

Re: XSLT/JAXB exception

> 
> How are you setting saxon to be your XSL processor?
> 
> -Rob

I don't think that's the issue, Rob (though it was my first instinct as
well): the stack traces show that Saxon has been successfully loaded. The
failure is happening deep within some JAXB code invoked by Saxon as the
ContentHandler for processing the result tree.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 
> 
> 
> On Aug 13, 2009, at 9:58 AM, Nord, James wrote:
> 
> > HI all,
> >
> > I have a Linux only issue with an XLST Transform and JAX-B. 
> The same 
> > code runs fine on Windows XP (sun 32bit JDK 1.6.0_16 in both cases)
> >    TransformerFactory factory = TransformerFactory.newInstance();
> >    template = factory.newTemplates(xsltFile); // this is an actual 
> > java.io.File
> >    Transformer transformer = template.newTransformer();
> >    Document dom = ... // obtain w3C DOM
> >
(Continue reading)

Andrew Welch | 14 Aug 13:33 2009
Picon

Re: XSLT/JAXB exception

2009/8/14 Michael Kay <mike@...>:
>>
>> How are you setting saxon to be your XSL processor?
>>
>> -Rob
>
> I don't think that's the issue, Rob (though it was my first instinct as
> well): the stack traces show that Saxon has been successfully loaded. The
> failure is happening deep within some JAXB code invoked by Saxon as the
> ContentHandler for processing the result tree.

I have a distant memory about JAXB complaining if saxon-dom.jar wasnt
on the classpath...

--

-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Michael Kay | 14 Aug 13:50 2009

Re: XSLT/JAXB exception

> 
> I have a distant memory about JAXB complaining if 
> saxon-dom.jar wasnt on the classpath...
> 

Wasn't it the other way around? I think there was some bug where it was
loading an identity transformer using the JAXP factory mechanisms, and then
assuming that the loaded identity transformer would always be Xalan.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Nord, James | 14 Aug 15:14 2009

Re: XSLT/JAXB exception

Hi all,

Thanks for the suggestions guys.

I (think) I've managed to track it down to a JDK issue as the Linux jdk
was different to my windows jdk (update 14 vs update7).

Update 14 included the latest JAX-B and removing saxon from the
classpath and using a simple XLST v1 transform I could still reproduce
it.
In the end the transform was creating XML that was not valid according
to the schema and then JAX-B was throwing a very very non intuitive
error.

An element declared as <xs:element name="myValue" type="xs:boolean" />
Was being written as <myValue/> and this caused the error.
https://jaxb.dev.java.net/issues/show_bug.cgi?id=490.  Very helpful and
descriptive :-0

/James

> -----Original Message-----
> From: Andrew Welch [mailto:andrew.j.welch@...] 
> Sent: 14 August 2009 12:33
> To: Mailing list for the SAXON XSLT and XQuery processor
> Subject: Re: [saxon] XSLT/JAXB exception
> 
> 2009/8/14 Michael Kay <mike@...>:
> >>
> >> How are you setting saxon to be your XSL processor?
(Continue reading)


Gmane