You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Marcos Truchado Martín <ma...@hp.com> on 2006/02/16 13:04:06 UTC

help with .betwixt files

Hi.

I´m looking for a way of set the property "WrapCollectionsInElement" in 
the <info/> element under a .betwixt file. Does anyone know how to do 
it?, I think that must be a way in the same way you can tell betwixt to 
set primitiveTypes as attribute or element. This is a lot of usefull 
when for example I have some collections that needs to be wrapped and 
others not (having a .betwixt file per class).

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: help with .betwixt files

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Thu, 2006-02-16 at 13:04 +0100, Marcos Truchado Martín wrote:
> Hi.

hi marcus

> I´m looking for a way of set the property "WrapCollectionsInElement" in 
> the <info/> element under a .betwixt file. Does anyone know how to do 
> it?, I think that must be a way in the same way you can tell betwixt to 
> set primitiveTypes as attribute or element. This is a lot of usefull 
> when for example I have some collections that needs to be wrapped and 
> others not (having a .betwixt file per class).

this isn't need when using the dot betwixt format. you can add
structural elements just very simple: they are just elements not mapped
to properties. for example

<info>
   ...
   <element name='collection-wrapper'>
      <element name='collection-member' property='bound-property-name'/>
   </element>
</info>

see http://jakarta.apache.org/commons/betwixt/guide/start.html#.betwixt%
20files for more information

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: How to stream xml document with httpclient

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2006-02-16 at 13:12 +0100, Peter Neu wrote:
> Hello,
> 
> I have the use case that I need to stream an xml document after the sax
> transformation with httpclient's post.setRequestEntity method. 
> 
> The sax tranformstation looks like this: 
> 
> PrintWriter out = response.getWriter();
> StreamResult streamResult = new StreamResult(out);
> SAXTransformerFactory tf = (SAXTransformerFactory)
> SAXTransformerFactory.newInstance();
> TransformerHandler hd = tf.newTransformerHandler();
> Transformer serializer = hd.getTransformer();
> serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
> serializer.setOutputProperty(OutputKeys.INDENT, "yes");
> hd.setResult(streamResult);
> AttributesImpl atts = new AttributesImpl();
> hd.startDocument();
> hd.startElement("", "", "Document", atts);
> hd.characters("Hello Document".toCharArray(), 0, "Hello Document".length());
> atts.clear();
> hd.endElement("", "", "Document");
> hd.endDocument();
> 
> Then I need to insert it to the post method:
> 
> post.setRequestEntity(new InputStreamRequestEntity(
>                 new FileInputStream(input), input.length()));
> 
> How can I do this?
> 

Pete,

Implement a custom request entity

Oleg


> Cheers,
> Pete
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


How to stream xml document with httpclient

Posted by Peter Neu <pe...@gmx.net>.
Hello,

I have the use case that I need to stream an xml document after the sax
transformation with httpclient's post.setRequestEntity method. 

The sax tranformstation looks like this: 

PrintWriter out = response.getWriter();
StreamResult streamResult = new StreamResult(out);
SAXTransformerFactory tf = (SAXTransformerFactory)
SAXTransformerFactory.newInstance();
TransformerHandler hd = tf.newTransformerHandler();
Transformer serializer = hd.getTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
hd.setResult(streamResult);
AttributesImpl atts = new AttributesImpl();
hd.startDocument();
hd.startElement("", "", "Document", atts);
hd.characters("Hello Document".toCharArray(), 0, "Hello Document".length());
atts.clear();
hd.endElement("", "", "Document");
hd.endDocument();

Then I need to insert it to the post method:

post.setRequestEntity(new InputStreamRequestEntity(
                new FileInputStream(input), input.length()));

How can I do this?

Cheers,
Pete



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org