Package com.adobe.epubcheck.ctc

Source Code of com.adobe.epubcheck.ctc.EpubTocCheck

package com.adobe.epubcheck.ctc;

import com.adobe.epubcheck.api.Report;
import com.adobe.epubcheck.ctc.epubpackage.EpubPackage;
import com.adobe.epubcheck.ctc.epubpackage.PackageSpine;
import com.adobe.epubcheck.messages.MessageId;
import com.adobe.epubcheck.messages.MessageLocation;
import com.adobe.epubcheck.opf.DocumentValidator;
import com.adobe.epubcheck.util.EPUBVersion;

public class EpubTocCheck implements DocumentValidator
{
  private final String pathRootFile;
  private final EpubPackage epack;
  private final Report report;

  public EpubTocCheck(EpubPackage epack, Report report)
  {
    this.pathRootFile = epack.getPackageMainFile();
    this.epack = epack;
    this.report = report;
  }

  @Override
  public boolean validate()
  {
    boolean result = true;
    PackageSpine spine = epack.getSpine();
    if (spine == null || (spine.getToc() == null && epack.getVersion() == EPUBVersion.VERSION_2))
    {
      report.message(MessageId.NCX_002, new MessageLocation(pathRootFile, -1, -1));
      result = false;
    }
    return result;
  }
}
TOP

Related Classes of com.adobe.epubcheck.ctc.EpubTocCheck

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.