You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Dasarath Weeratunge <da...@yahoo.com> on 2005/03/10 12:00:33 UTC
[Axis2] Using XMLBeans with OM
FYI:
The way XMLStreamReader is implemented in OM and
XMLBeans is different. When you call
newXMLStreamReader on an XMLBeans generated class, the
returned reader is positioned on the element: if u
call next u get the local name. However, when you call
getPullParser on an OMElement you must call next once
before you can call getName. So at present the
following code won't work.
public void submitPurchaseOrder(PurchaseOrderDocument
doc) throws Exception {
SOAPEnvelope env = factory.getDefaultEnvelope();
StAXOMBuilder builder = new
StAXOMBuilder(doc.newXMLStreamReader(), true);
env.getBody().addChild(builder.getDocumentElement());
Due to the same reason the following is also not
possible:
public OMElement submitPurchaseOrderWrapper(OMElement
e){
try {
submitPurchaseOrder(PurchaseOrderDocument.Factory.parse(e.newXMLStreamReader(true)));
--Dasarath
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
Re: [Axis2] Using XMLBeans with OM
Posted by Aleksander Slominski <as...@cs.indiana.edu>.
so why not to change code in AXIS2 OM to read from wherever stax curosr
(reader) is positioned?
alek
Dasarath Weeratunge wrote:
>FYI:
>
>The way XMLStreamReader is implemented in OM and
>XMLBeans is different. When you call
>newXMLStreamReader on an XMLBeans generated class, the
>returned reader is positioned on the element: if u
>call next u get the local name. However, when you call
>getPullParser on an OMElement you must call next once
>before you can call getName. So at present the
>following code won't work.
>
>public void submitPurchaseOrder(PurchaseOrderDocument
>doc) throws Exception {
> SOAPEnvelope env = factory.getDefaultEnvelope();
> StAXOMBuilder builder = new
>StAXOMBuilder(doc.newXMLStreamReader(), true);
>
>env.getBody().addChild(builder.getDocumentElement());
>
>
>Due to the same reason the following is also not
>possible:
>
>public OMElement submitPurchaseOrderWrapper(OMElement
>e){
> try {
>
>submitPurchaseOrder(PurchaseOrderDocument.Factory.parse(e.newXMLStreamReader(true)));
>
>
>--Dasarath
>
>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Small Business - Try our new resources site!
>http://smallbusiness.yahoo.com/resources/
>
>
--
The best way to predict the future is to invent it - Alan Kay
Re: [Axis2] Using XMLBeans with OM
Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
"Dasarath Weeratunge" <da...@yahoo.com> writes:
> FYI:
>
> The way XMLStreamReader is implemented in OM and
> XMLBeans is different. When you call
> newXMLStreamReader on an XMLBeans generated class, the
> returned reader is positioned on the element: if u
> call next u get the local name. However, when you call
> getPullParser on an OMElement you must call next once
> before you can call getName. So at present the
> following code won't work.
>
> public void submitPurchaseOrder(PurchaseOrderDocument
> doc) throws Exception {
> SOAPEnvelope env = factory.getDefaultEnvelope();
> StAXOMBuilder builder = new
> StAXOMBuilder(doc.newXMLStreamReader(), true);
>
> env.getBody().addChild(builder.getDocumentElement());
In this particular scenario, don't we really want to say
something like
env.setBody (builder)
instead? Otherwise if someone immediately asks for the body
after the new thing is added then we'll be going thru
StAX -> OM -> StAX whereas by doing the above you can just
effectively return the original StAX stream.
Sanjiva.