Skip to content
Permalink
Browse files
remove check for xml header as too many xhtml files are missing it
  • Loading branch information
kevinhendricks committed Oct 25, 2020
1 parent d7c8beb commit 378024f4e708808d3ee1a661324b54efd6fa1a92
Showing with 2 additions and 11 deletions.
  1. +0 −9 src/BookManipulation/XhtmlDoc.cpp
  2. +2 −2 src/Importers/ImportEPUB.cpp
@@ -280,15 +280,13 @@ XhtmlDoc::WellFormedError XhtmlDoc::GumboWellFormedErrorForSource(const QString
XhtmlDoc::WellFormedError XhtmlDoc::WellFormedErrorForSource(const QString &source, QString version)
{
QXmlStreamReader reader(source);
int nxmlheaders = 0;
int ndoctypes = 0;
int nhtmltags = 0;
int nheadtags = 0;
int nbodytags = 0;

while (!reader.atEnd()) {
reader.readNext();
if (reader.isStartDocument()) nxmlheaders++;
if (reader.isDTD()) ndoctypes++;
if (reader.isStartElement()) {
if (reader.name() == "html") nhtmltags++;
@@ -304,13 +302,6 @@ XhtmlDoc::WellFormedError XhtmlDoc::WellFormedErrorForSource(const QString &sour
return error;
}
// make sure basic structure in place
if (nxmlheaders != 1) {
XhtmlDoc::WellFormedError error;
error.line = 1;
error.column = 1;
error.message = "Missing xml header";
return error;
}
if (ndoctypes != 1) {
XhtmlDoc::WellFormedError error;
error.line = 1;
@@ -197,8 +197,8 @@ QSharedPointer<Book> ImportEPUB::GetBook(bool extract_metadata)
if (QMessageBox::Yes == QMessageBox::warning(QApplication::activeWindow(),
tr("Sigil"),
tr("This EPUB has HTML files that are not well formed or are "
"missing a xml header, DOCTYPE, html, head or body "
"elements. Sigil can automatically fix these files, although "
"missing a DOCTYPE, html, head or body elements. "
"Sigil can automatically fix these files, although "
"this may result in minor data loss in extreme circumstances.\n\n"
"Do you want to automatically fix the files?"),
QMessageBox::Yes|QMessageBox::No))

0 comments on commit 378024f

Please sign in to comment.