private OfficeDocument parseContentXml()
{
// Check whether this is a content.xml.
if (!OfficeNamespaces.OFFICE_NS.equals(getUri()) || "document-content".equals(getTagName()))
{
return new OfficeDocument();
}
// we may have to parse an existing content.xml.
final ResourceKey contextKey = getRootHandler().getContext();
final ResourceManager resourceManager = getRootHandler().getResourceManager();
try
{
final ResourceKey key =
resourceManager.deriveKey(contextKey, "content.xml");
final Resource resource =
resourceManager.create(key, contextKey, JFreeReport.class);
final OfficeDocument doc = (OfficeDocument) resource.getResource();
if (doc != null)
{
return doc;
}
}
catch (ResourceKeyCreationException e)
{
// ignore ..
LOGGER.debug("Failed to create resource-key for 'content.xml'. Ignoring.");
}
catch (ResourceException e)
{
// ignore ..
LOGGER.debug("Failed to parse resource for 'content.xml'. Ignoring.");
}
return new OfficeDocument();
}