EpubCSSCheckCSSHandler handler = new EpubCSSCheckCSSHandler(report, isGlobalFixed, hasFixedFormatItems);
int numCssFiles = 0;
for (int i = 0; i < epack.getManifest().itemsLength(); i++)
{
ManifestItem itemEntry = epack.getManifest().getItem(i);
if (cssTypes.isValidMediaType(itemEntry.getMediaType()))
{
++numCssFiles;
String fileToParse = getEntryFileName(itemEntry, epack);
ZipEntry entry = epack.getZip().getEntry(fileToParse);
if (entry == null)
{
report.message(MessageId.RSC_001, new MessageLocation(epack.getFileName(), -1, -1), fileToParse);
continue;
}
try
{
InputStream inputStream = getInputStream(fileToParse);
CssSource source = new CssSource(fileToParse, inputStream);
CssParser parser = new CssParser();
handler.setPath(fileToParse);
parser.parse(source, handler, handler);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
for (int i = 0; i < epack.getManifest().itemsLength(); i++)
{
ManifestItem itemEntry = epack.getManifest().getItem(i);
if (validTypes.isValidMediaType(itemEntry.getMediaType()))
{
String fileToParse = getEntryFileName(itemEntry, epack);
ZipEntry entry = epack.getZip().getEntry(fileToParse);
if (entry == null)
{
report.message(MessageId.RSC_001, new MessageLocation(epack.getFileName(), -1, -1), fileToParse);
continue;
}
XMLContentDocParser parser;
String properties = itemEntry.getProperties();
boolean itemIsFixedFormat = (properties != null && properties.contains("rendition:layout-pre-paginated"));
parser = new XMLContentDocParser(epack.getZip(), report);
CSSStyleAttributeHandler h = new CSSStyleAttributeHandler(isGlobalFixed, itemIsFixedFormat);
h.setCssHandler(handler);