Document apple2xmlDoc = docBuilder.parse(new ByteArrayInputStream(apple2xml.getBytes()));
Document orangeXmlDoc = docBuilder.parse(new ByteArrayInputStream(orangeXml.getBytes()));
Document fruitBagXmlDoc = docBuilder.parse(new ByteArrayInputStream(fruitBagXml.getBytes()));
// construct new objects from the XML
XMLParser xmlp = UIMAFramework.getXMLParser();
MetaDataObject_impl newApple1 = (MetaDataObject_impl) unknownFruit.clone();
newApple1.buildFromXMLElement(apple1xmlDoc.getDocumentElement(), xmlp);
MetaDataObject_impl newApple2 = (MetaDataObject_impl) unknownFruit.clone();
newApple2.buildFromXMLElement(apple2xmlDoc.getDocumentElement(), xmlp);
MetaDataObject_impl newOrange = (MetaDataObject_impl) unknownFruit.clone();
newOrange.buildFromXMLElement(orangeXmlDoc.getDocumentElement(), xmlp);
xmlp.addMapping("fruit", TestFruitObject.class.getName());
MetaDataObject_impl newFruitBag = new TestFruitBagObject();
newFruitBag.buildFromXMLElement(fruitBagXmlDoc.getDocumentElement(), xmlp);
// new objects should be equal to the originals