Улучшено распознавание xml-формата

This commit is contained in:
Book Pauk
2020-12-15 15:04:30 +07:00
parent b1f5f3dd28
commit 8ef6551560
3 changed files with 10 additions and 2 deletions

View File

@@ -103,6 +103,11 @@ class ConvertBase {
return he.escape(he.decode(text.replace(/ /g, ' ')));
}
isDataXml(data) {
const str = data.toString().trim();
return (str.indexOf('<?xml version="1.0"') == 0 || str.indexOf('<?xml version=\'1.0\'') == 0 );
}
formatFb2(fb2) {
const out = xmlParser.formatXml({
FictionBook: {