Skip to content
Permalink
Browse files
Use the proper APIs to create OMSourcedElements.
  • Loading branch information
veithen committed Jul 15, 2011
1 parent eaee8ee commit 085190ba66ba2e4d55203615faaf5dc69fdfff61
Showing 1 changed file with 6 additions and 7 deletions.
@@ -32,7 +32,6 @@
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromDataSource;
import org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromReader;
import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
import org.apache.axis2.AxisFault;
import org.apache.axis2.builder.BuilderUtil;
import org.apache.axis2.context.MessageContext;
@@ -80,8 +79,8 @@ public OMElement processDocument(InputStream inputStream,
} catch (UnsupportedEncodingException ex) {
throw new AxisFault("Unsupported encoding: " + charSetEnc, ex);
}
return new OMSourcedElementImpl(wrapperQName, factory,
new WrappedTextNodeOMDataSourceFromReader(wrapperQName, reader));
return factory.createOMElement(new WrappedTextNodeOMDataSourceFromReader(wrapperQName,
reader), wrapperQName);
}

public OMElement processDocument(Reader reader,
@@ -90,8 +89,8 @@ public OMElement processDocument(Reader reader,

OMFactory factory = OMAbstractFactory.getOMFactory();
QName wrapperQName = getWrapperQName(msgContext);
return new OMSourcedElementImpl(wrapperQName, factory,
new WrappedTextNodeOMDataSourceFromReader(wrapperQName, reader));
return factory.createOMElement(new WrappedTextNodeOMDataSourceFromReader(wrapperQName,
reader), wrapperQName);
}

public OMElement processDocument(String content,
@@ -110,7 +109,7 @@ public OMElement processDocument(DataSource dataSource,
OMFactory factory = OMAbstractFactory.getOMFactory();
Charset cs = Charset.forName(BuilderUtil.getCharSetEncoding(contentType));
QName wrapperQName = getWrapperQName(msgContext);
return new OMSourcedElementImpl(wrapperQName, factory,
new WrappedTextNodeOMDataSourceFromDataSource(wrapperQName, dataSource, cs));
return factory.createOMElement(new WrappedTextNodeOMDataSourceFromDataSource(wrapperQName,
dataSource, cs), wrapperQName);
}
}

0 comments on commit 085190b

Please sign in to comment.