users@jersey.java.net

RE: [Jersey] Marshaling JAXB objects including stylesheet information

From: Rabick, Mark A (MS) <"Rabick,>
Date: Tue, 10 Mar 2009 13:56:42 -0500

> but don't know how to
> dynamically generate the schema on the server (in the webapp) and get
> a common URI for the xsd (like the application.wadl).

That's helpful in adding an XML preamble but how do I (given an object
model with JAXB annotations) generate an XSD inside the web-app without
having to use an external schemagen to created the xsd file and have
that XSD included in the wadl, with a prefix, to be included in the
WADL?

I've already implemented a WADL translator at URI

/application.wadl.html

That uses Saxon to transform the wadl XML to HTML using the WADL-to-XML
stylesheet at:

http://www.mnot.net/webdesc/
(http://www.mnot.net/webdesc/wadl_documentation.xsl)

It returns application/html.

-mark

_______________________________________________
Mark A. Rabick - Software Engineer
Em: mark.rabick_at_ngc.com

 

> -----Original Message-----
> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
> Sent: Tuesday, March 10, 2009 7:37 AM
> To: users_at_jersey.dev.java.net
> Subject: Re: [Jersey] Marshaling JAXB objects including
> stylesheet information
>
> Hi,
>
> For setting the style sheet see:
>
> https://jaxb.dev.java.net/nonav/2.1.10/docs/
> vendorProperties.html#xmlheader
>
> You can do this:
>
> Marshaller m = ...
> m.setProperty("com.sun.xml.bind.xmlHeaders", "<?xml-
> stylesheet type='text/xsl' href='foobar.xsl' ?>");
>
> Paul.
>
> On Mar 5, 2009, at 4:41 PM, Rabick, Mark A (MS) wrote:
>
> > I'm also interested in including stylesheet info in the
> returned xml
> > output. I can use the JAXB schemagen task or bat file to
> generate the
> > xsd outside of my normal build process but don't know how to
> > dynamically generate the schema on the server (in the
> webapp) and get
> > a common URI for the xsd (like the application.wadl). I'd be
> > interested in seeing the rest code that actually passes in
> the URI to
> > your code below...
> >
> >> /* xslPath is passed in as a URI */
> >
> > --mark
> > _______________________________________________
> > Mark A. Rabick - Software Engineer
> > Em: mark.rabick_at_ngc.com
> >
> >
> >
> >> -----Original Message-----
> >> From: Christopher Piggott [mailto:cpiggott_at_gmail.com]
> >> Sent: Thursday, March 05, 2009 8:35 AM
> >> To: users_at_jersey.dev.java.net
> >> Subject: [Jersey] Marshaling JAXB objects including stylesheet
> >> information
> >>
> >> I'd like to be able to include an xml-stylesheet processing
> >> instruction in the xml output from my jersey resources. I figured
> >> out a way to accomplish this whereby I do the marshalling myself:
> >>
> >> /* xslPath is passed in as a URI */
> >> w.write("<?xml version=\"1.0\" encoding=\""
> >> + marshaller.getProperty(Marshaller.JAXB_ENCODING)
> >> + "\"?>\n");
> >> w.write("<?xml-stylesheet type=\"text/xsl\""
> >> + " href=\""
> >> + xslPath.toASCIIString()
> >> + "\"?>\n");
> >> marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
> >> marshaller.marshal(item, w);
> >>
> >> but this is pretty ugly stuff.
> >>
> >> Anybody have a better idea?
> >>
> >> --Chris
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> >> For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >>
> >>
> >>
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>