Writing Composite and Component Properties

2007-08-30 Thread Venkata Krishnan
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

2007-08-30 Thread Raymond Feng

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 [EMAIL PROTECTED]

To: tuscany-dev@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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Writing Composite and Component Properties

2007-08-30 Thread Venkata Krishnan
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
 To: tuscany-dev@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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Writing Composite and Component Properties

2007-08-30 Thread Raymond Feng

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 [EMAIL PROTECTED]

To: tuscany-dev@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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
To: tuscany-dev@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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]