#include <TextTest.h>

Static Public Member Functions

static bool isApparentTextDocument (FileSource)
 Return true if the source appears to point to a text format of some kind (could be CSV, XML, RDF/Turtle etc). More...
 

Detailed Description

Definition at line 20 of file TextTest.h.

Member Function Documentation

bool TextTest::isApparentTextDocument ( FileSource  source)
static

Return true if the source appears to point to a text format of some kind (could be CSV, XML, RDF/Turtle etc).

We apply two tests and report success if either succeeds:

  1. The first few hundred bytes (where present) of the document are valid UTF-8
  2. The document starts with the text "<?xml" when opened using QXmlInputSource (which guesses its text encoding)

So we only accept non-UTF-8 encodings where they also happen to be XML documents.

Definition at line 24 of file TextTest.cpp.

References FileSource::getLocalFilename(), FileSource::getLocation(), FileSource::isAvailable(), StringBits::isValidUtf8(), and SVDEBUG.

Referenced by RDFImporter::isPlausibleDocumentOfAnyKind().


The documentation for this class was generated from the following files: