You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Venkata Krishnan <fo...@gmail.com> on 2007/08/30 15:28:49 UTC

Writing Composite and Component Properties

Hi,

I am working on https://issues.apache.org/jira/browse/TUSCANY-1482 and its
mostly done -  just the only thing related writing the property values.  The
Property class has this value as a xml Document already and it would be good
if we could simply write that out.  Right now I don't see a way to do this
from the XMLStreamWriter interface.  I am trying to avoid having to parse
this document value which is already an XML doc and then write it again as
XML which seems a bit absurd.  Would it be good to directly make use of the
output stream that underlies the XMLStreamWriter ?  If so how would the
CompositeProcessor's write method avail this ?   Are there other
alternatives that people can help me with ?

Thanks

- Venkat

Re: Writing Composite and Component Properties

Posted by Raymond Feng <en...@gmail.com>.
Hi,

I meant to re-use some of the code in databinding module instead of adding 
it as dependency to assembly-xml. BTW, writing a converter from DOM to 
XMLStreamWriter is probably not too complex.

Thanks,
Raymond

----- Original Message ----- 
From: "Venkata Krishnan" <fo...@gmail.com>
To: <tu...@ws.apache.org>
Sent: Thursday, August 30, 2007 11:50 AM
Subject: Re: Writing Composite and Component Properties


> Hi Raymond,
>
> Thanks for responding.  As far as I saw the stax-utils have only snapshots
> published.  If this is indeed true then it seems like option 1 is better.
> But with option 1, is it good to bring in the databinding as a dependency
> into assembly-xml.  To me assembly-xml seems to be at must lower layer to
> databinding.   Please let me know your opinions about this.
>
> Thanks
>
> - Venkat
>
> On 8/30/07, Raymond Feng <en...@gmail.com> wrote:
>>
>> Hi,
>>
>> There are a few ways you can handle this:
>>
>> 1) Use the code in the "databinding" module:
>>
>> Node2XMLStreamReader and then XMLStreamSerializer
>>
>> 2) Use a BSD-licensed StAXUtils at
>> https://stax-utils.dev.java.net/nonav/javadoc/utils/index.html.
>>     // create a DOMSource
>>     Document doc =
>> DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(...);
>>     Source domSource = new DOMSource(doc);
>>
>>     // create a StAXResult
>>     XMLStreamWriter writer =
>> XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
>>     Result staxResult = new StAXResult(writer);
>>
>>     // run the transform
>> 
>> TransformerFactory.newInstance().newTransformer().transform(domSource,
>> staxResult);
>>
>> Thanks,
>> Raymond
>>
>> ----- Original Message -----
>> From: "Venkata Krishnan" <fo...@gmail.com>
>> To: <tu...@ws.apache.org>
>> Sent: Thursday, August 30, 2007 6:28 AM
>> Subject: Writing Composite and Component Properties
>>
>>
>> > Hi,
>> >
>> > I am working on https://issues.apache.org/jira/browse/TUSCANY-1482 and
>> its
>> > mostly done -  just the only thing related writing the property values.
>> > The
>> > Property class has this value as a xml Document already and it would be
>> > good
>> > if we could simply write that out.  Right now I don't see a way to do
>> this
>> > from the XMLStreamWriter interface.  I am trying to avoid having to
>> parse
>> > this document value which is already an XML doc and then write it again
>> as
>> > XML which seems a bit absurd.  Would it be good to directly make use of
>> > the
>> > output stream that underlies the XMLStreamWriter ?  If so how would the
>> > CompositeProcessor's write method avail this ?   Are there other
>> > alternatives that people can help me with ?
>> >
>> > Thanks
>> >
>> > - Venkat
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Writing Composite and Component Properties

Posted by Venkata Krishnan <fo...@gmail.com>.
Hi Raymond,

Thanks for responding.  As far as I saw the stax-utils have only snapshots
published.  If this is indeed true then it seems like option 1 is better.
But with option 1, is it good to bring in the databinding as a dependency
into assembly-xml.  To me assembly-xml seems to be at must lower layer to
databinding.   Please let me know your opinions about this.

Thanks

- Venkat

On 8/30/07, Raymond Feng <en...@gmail.com> wrote:
>
> Hi,
>
> There are a few ways you can handle this:
>
> 1) Use the code in the "databinding" module:
>
> Node2XMLStreamReader and then XMLStreamSerializer
>
> 2) Use a BSD-licensed StAXUtils at
> https://stax-utils.dev.java.net/nonav/javadoc/utils/index.html.
>     // create a DOMSource
>     Document doc =
> DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(...);
>     Source domSource = new DOMSource(doc);
>
>     // create a StAXResult
>     XMLStreamWriter writer =
> XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
>     Result staxResult = new StAXResult(writer);
>
>     // run the transform
>     TransformerFactory.newInstance().newTransformer().transform(domSource,
> staxResult);
>
> Thanks,
> Raymond
>
> ----- Original Message -----
> From: "Venkata Krishnan" <fo...@gmail.com>
> To: <tu...@ws.apache.org>
> Sent: Thursday, August 30, 2007 6:28 AM
> Subject: Writing Composite and Component Properties
>
>
> > Hi,
> >
> > I am working on https://issues.apache.org/jira/browse/TUSCANY-1482 and
> its
> > mostly done -  just the only thing related writing the property values.
> > The
> > Property class has this value as a xml Document already and it would be
> > good
> > if we could simply write that out.  Right now I don't see a way to do
> this
> > from the XMLStreamWriter interface.  I am trying to avoid having to
> parse
> > this document value which is already an XML doc and then write it again
> as
> > XML which seems a bit absurd.  Would it be good to directly make use of
> > the
> > output stream that underlies the XMLStreamWriter ?  If so how would the
> > CompositeProcessor's write method avail this ?   Are there other
> > alternatives that people can help me with ?
> >
> > Thanks
> >
> > - Venkat
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>

Re: Writing Composite and Component Properties

Posted by Raymond Feng <en...@gmail.com>.
Hi,

There are a few ways you can handle this:

1) Use the code in the "databinding" module:

Node2XMLStreamReader and then XMLStreamSerializer

2) Use a BSD-licensed StAXUtils at 
https://stax-utils.dev.java.net/nonav/javadoc/utils/index.html.
    // create a DOMSource
    Document doc = 
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(...);
    Source domSource = new DOMSource(doc);

    // create a StAXResult
    XMLStreamWriter writer = 
XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
    Result staxResult = new StAXResult(writer);

    // run the transform
    TransformerFactory.newInstance().newTransformer().transform(domSource, 
staxResult);

Thanks,
Raymond

----- Original Message ----- 
From: "Venkata Krishnan" <fo...@gmail.com>
To: <tu...@ws.apache.org>
Sent: Thursday, August 30, 2007 6:28 AM
Subject: Writing Composite and Component Properties


> Hi,
>
> I am working on https://issues.apache.org/jira/browse/TUSCANY-1482 and its
> mostly done -  just the only thing related writing the property values. 
> The
> Property class has this value as a xml Document already and it would be 
> good
> if we could simply write that out.  Right now I don't see a way to do this
> from the XMLStreamWriter interface.  I am trying to avoid having to parse
> this document value which is already an XML doc and then write it again as
> XML which seems a bit absurd.  Would it be good to directly make use of 
> the
> output stream that underlies the XMLStreamWriter ?  If so how would the
> CompositeProcessor's write method avail this ?   Are there other
> alternatives that people can help me with ?
>
> Thanks
>
> - Venkat
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org