// is content a reference to a file?
if (container.isInlineFilesEnabled() && textContent.startsWith("file:")) {
String filename = textContent.substring(5);
if (container.isMtomEnabled()) {
MimeBodyPart part = new PreencodedMimeBodyPart("binary");
String xmimeContentType = getXmlMimeContentType(cursor);
if (StringUtils.isNullOrEmpty(xmimeContentType)) {
xmimeContentType = ContentTypeHandler.getContentTypeFromFilename(filename);
}
part.setDataHandler(new DataHandler(new XOPPartDataSource(new File(filename),
xmimeContentType, schemaType)));
part.setContentID("<" + filename + ">");
mp.addBodyPart(part);
isXopAttachment = true;
} else {
if (new File(filename).exists()) {
inlineData(cursor, schemaType, new FileInputStream(filename));
} else {
Attachment att = getAttachmentForFilename(container, filename);
if (att != null) {
inlineData(cursor, schemaType, att.getInputStream());
}
}
}
} else {
Attachment[] attachmentsForPart = container.getAttachmentsForPart(textContent);
if (textContent.startsWith("cid:")) {
textContent = textContent.substring(4);
attachmentsForPart = container.getAttachmentsForPart(textContent);
Attachment[] attachments = attachmentsForPart;
if (attachments.length == 1) {
attachment = attachments[0];
} else if (attachments.length > 1) {
attachment = buildMulitpartAttachment(attachments);
}
isXopAttachment = container.isMtomEnabled();
contentIds.put(textContent, textContent);
}
// content should be binary data; is this an XOP element
// which should be serialized with MTOM?
else if (container.isMtomEnabled()
&& (SchemaUtils.isBinaryType(schemaType) || SchemaUtils.isAnyType(schemaType))) {
if ("true".equals(System.getProperty("soapui.mtom.strict"))) {
if (SchemaUtils.isAnyType(schemaType)) {
textContent = null;
} else {
for (int c = 0; c < textContent.length(); c++) {
if (Character.isWhitespace(textContent.charAt(c))) {
textContent = null;
break;
}
}
}
}
if (textContent != null) {
MimeBodyPart part = new PreencodedMimeBodyPart("binary");
String xmimeContentType = getXmlMimeContentType(cursor);
part.setDataHandler(new DataHandler(new XOPPartDataSource(textContent,
xmimeContentType, schemaType)));
textContent = "http://www.soapui.org/" + System.nanoTime();
part.setContentID("<" + textContent + ">");
mp.addBodyPart(part);
isXopAttachment = true;
}
} else if (container.isInlineFilesEnabled() && attachmentsForPart != null