for(String eDocPath : embDocs.keySet()){
OdfDocument doc1 = embDocs.get(eDocPath);
Assert.assertNotNull(doc1);
OdfContentDom contentDom = doc1.getContentDom();
XPath xpath = contentDom.getXPath();
TextPElement para = (TextPElement) xpath.evaluate("//text:p[1]", contentDom, XPathConstants.NODE);
OdfTextSpan spanElem = new OdfTextSpan(contentDom);
spanElem.setTextContent(TEST_SPAN_TEXT);
para.appendChild(spanElem);
//save the embed document to a stand alone document
doc1.save(TEST_FILE_SAVE_EMBEDDED_OUT);
// Load test
OdfDocument loadedDoc = OdfDocument.loadDocument(TEST_FILE_SAVE_EMBEDDED_OUT);
OdfContentDom contentDom2 = loadedDoc.getContentDom();
OdfTextSpan span = (OdfTextSpan) xpath.evaluate("//text:span[last()]", contentDom2, XPathConstants.NODE);
Assert.assertEquals(span.getTextContent(), TEST_SPAN_TEXT);
Map<String, OdfDocument> embDocs3 = docWithEmbeddedObjects.loadSubDocuments(OdfDocument.OdfMediaType.TEXT);
for(String eDocPath3 : embDocs3.keySet()){
// Writer Doc
OdfDocument doc3 = embDocs3.get(eDocPath3);
Assert.assertNotNull(doc3);
OdfContentDom contentDom3 = doc3.getContentDom();
TextPElement para2 = (TextPElement) xpath.evaluate("//text:p[1]", contentDom3, XPathConstants.NODE);
addImageToDocument(contentDom3, para2);
TextPElement para3 = (TextPElement) xpath.evaluate("//text:p[last()]", contentDom3, XPathConstants.NODE);
addFrameForEmbeddedDoc(contentDom3, para3, "NewEmbedded");
doc3.insertDocument(OdfTextDocument.newTextDocument(), "/NewEmbedded/");
OdfDocument doc4 = doc3.loadSubDocument("NewEmbedded");
Assert.assertNotNull(doc4);
OdfContentDom contentDom4 = doc4.getContentDom();