private OfficeDocument parseContentXml()
{
if (OfficeNamespaces.OFFICE_NS.equals(getUri()) == false)
{
return new OfficeDocument();
}
// Check whether this is a content.xml.
if ("document-content".equals(getTagName()) != false)
{
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 report = (OfficeDocument) resource.getResource();
if (report != null)
{
return report;
}
}
catch (ResourceKeyCreationException e)
{
// ignore ..
Log.debug("Failed to create resource-key for 'content.xml'. Ignoring.");
}
catch (ResourceException e)
{
// ignore ..
Log.debug("Failed to parse resource for 'content.xml'. Ignoring.");
}
return new OfficeDocument();
}