public OMElement create(String namespaceURI, String localPart,
OMContainer parent, XMLStreamReader reader, OMFactory factory)
throws OMException {
try {
XOPEncodedStream xopStream = XOPUtils.getXOPEncodedStream(reader);
XMLStreamReader encodedReader = xopStream.getReader();
if (expectBareReader) {
String className = encodedReader.getClass().getName();
Assert.assertTrue(!className.startsWith("org.apache.axiom.")
|| className.startsWith("org.apache.axiom.util.stax.dialect."));
}
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
AttachmentUnmarshallerImpl attachmentUnmarshaller = new AttachmentUnmarshallerImpl(xopStream.getMimePartProvider());
unmarshaller.setAttachmentUnmarshaller(attachmentUnmarshaller);
// For the purpose of the test we just store the JAXB object and return
// a dummy element. Normally, one would create an OMSourcedElement here.
jaxbObject = unmarshaller.unmarshal(encodedReader);
attachmentsAccessed = attachmentUnmarshaller.isAccessed();