DefaultParser
Generic document parser for raw content passthrough or text decoding
Notes
It uses Apache Tika for most of its supported content types. For unknown content types, it falls back to Tika's generic media detector/parser.
The format coverage described for DefaultParser reflects built-in importer
capabilities in Norconex Crawler. It is a practical baseline, not a fixed
ceiling. Teams can extend parser behavior and pipeline logic for
customer-specific formats and extraction requirements.
Three optional features hang off this parser, each with its own settings page:
embedded for documents inside documents, ocr for text inside images,
and grobid for scientific papers.
Examples
Saves documents that fail to parse into a directory for inspection.
- YAML
- JSON
- XML
handler:
class: DefaultParser
poolSize: 2
xmlParserPoolSize: 16
errorsSaveDir: C:\reports\errors
{
"handler": {
"class": "DefaultParser",
"poolSize": 2,
"xmlParserPoolSize": 16,
"errorsSaveDir": "C:\\reports\\errors"
}
}
<handler>
<class>DefaultParser</class>
<poolSize>2</poolSize>
<xmlParserPoolSize>16</xmlParserPoolSize>
<errorsSaveDir>C:\reports\errors</errorsSaveDir>
</handler>
Uses Tesseract to read English text out of the images inside PDFs.
- YAML
- JSON
- XML
handler:
class: DefaultParser
ocr:
tesseractPath: /app/ocr/tesseract
contentTypeMatcher:
method: BASIC
pattern: application/pdf
ignoreCase: true
language: eng
{
"handler": {
"class": "DefaultParser",
"ocr": {
"tesseractPath": "/app/ocr/tesseract",
"contentTypeMatcher": {
"method": "BASIC",
"pattern": "application/pdf",
"ignoreCase": true
},
"language": "eng"
}
}
}
<handler>
<class>DefaultParser</class>
<ocr>
<tesseractPath>/app/ocr/tesseract</tesseractPath>
<contentTypeMatcher>
<method>BASIC</method>
<pattern>application/pdf</pattern>
<ignoreCase>true</ignoreCase>
</contentTypeMatcher>
<language>eng</language>
</ocr>
</handler>
Splits the contents of ZIP files into individual documents, skips images embedded in any container, and leaves the contents of Word documents alone while still processing the Word document itself.
- YAML
- JSON
- XML
handler:
class: DefaultParser
embedded:
splitContentTypes:
- method: BASIC
pattern: application/zip
ignoreCase: true
skipEmbeddedContentTypes:
- method: REGEX
pattern: image/.*
ignoreCase: true
skipEmbeddedOfContentTypes:
- method: BASIC
pattern: application/msword
ignoreCase: true
{
"handler": {
"class": "DefaultParser",
"embedded": {
"splitContentTypes": [
{
"method": "BASIC",
"pattern": "application/zip",
"ignoreCase": true
}
],
"skipEmbeddedContentTypes": [
{
"method": "REGEX",
"pattern": "image/.*",
"ignoreCase": true
}
],
"skipEmbeddedOfContentTypes": [
{
"method": "BASIC",
"pattern": "application/msword",
"ignoreCase": true
}
]
}
}
}
<handler class="DefaultParser">
<embedded>
<splitContentTypes>
<splitContentType>
<method>BASIC</method>
<pattern>application/zip</pattern>
<ignoreCase>true</ignoreCase>
</splitContentType>
</splitContentTypes>
</embedded>
</handler>
Usage
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
class: DefaultParser
embedded:
discardContainerContentTypes:
- {}
maxEmbeddedDepth: 0
skipEmbeddedContentTypes:
- {}
skipEmbeddedOfContentTypes:
- {}
splitContentTypes:
- {}
errorsSaveDir: string
grobid:
enabled: false
serviceUrl: string
label: string
ocr:
applyRotation: false
colorSpace: string
contentTypeMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
density: 0
depth: 0
disabled: false
enableImagePreprocessing: false
filter: string
imageMagickPath: string
language: string
maxFileSizeToOcr: 0
minFileSizeToOcr: 0
pageSegMode: string
pageSeparator: string
preserveInterwordSpacing: false
resize: 0
skipOcr: false
tessdataPath: string
tesseractPath: string
timeoutSeconds: 0
poolSize: 0
xmlParserPoolSize: 0
{
"class": "DefaultParser",
"embedded": {
"discardContainerContentTypes": [
{}
],
"maxEmbeddedDepth": 0,
"skipEmbeddedContentTypes": [
{}
],
"skipEmbeddedOfContentTypes": [
{}
],
"splitContentTypes": [
{}
]
},
"errorsSaveDir": "string",
"grobid": {
"enabled": false,
"serviceUrl": "string"
},
"label": "string",
"ocr": {
"applyRotation": false,
"colorSpace": "string",
"contentTypeMatcher": {
"ignoreCase": false,
"ignoreDiacritic": false,
"matchEmpty": false,
"method": "BASIC",
"negateMatches": false,
"partial": false,
"pattern": "string",
"replaceAll": false,
"trim": false
},
"density": 0,
"depth": 0,
"disabled": false,
"enableImagePreprocessing": false,
"filter": "string",
"imageMagickPath": "string",
"language": "string",
"maxFileSizeToOcr": 0,
"minFileSizeToOcr": 0,
"pageSegMode": "string",
"pageSeparator": "string",
"preserveInterwordSpacing": false,
"resize": 0,
"skipOcr": false,
"tessdataPath": "string",
"tesseractPath": "string",
"timeoutSeconds": 0
},
"poolSize": 0,
"xmlParserPoolSize": 0
}
<handler>
<class>DefaultParser</class>
<embedded>
<discardContainerContentTypes>
<discardContainerContentType/>
</discardContainerContentTypes>
<maxEmbeddedDepth>0</maxEmbeddedDepth>
<skipEmbeddedContentTypes>
<skipEmbeddedContentType/>
</skipEmbeddedContentTypes>
<skipEmbeddedOfContentTypes>
<skipEmbeddedOfContentType/>
</skipEmbeddedOfContentTypes>
<splitContentTypes>
<splitContentType/>
</splitContentTypes>
</embedded>
<errorsSaveDir>string</errorsSaveDir>
<grobid>
<enabled>false</enabled>
<serviceUrl>string</serviceUrl>
</grobid>
<label>string</label>
<ocr>
<applyRotation>false</applyRotation>
<colorSpace>string</colorSpace>
<contentTypeMatcher>
<ignoreCase>false</ignoreCase>
<ignoreDiacritic>false</ignoreDiacritic>
<matchEmpty>false</matchEmpty>
<method>BASIC</method>
<negateMatches>false</negateMatches>
<partial>false</partial>
<pattern>string</pattern>
<replaceAll>false</replaceAll>
<trim>false</trim>
</contentTypeMatcher>
<density>0</density>
<depth>0</depth>
<disabled>false</disabled>
<enableImagePreprocessing>false</enableImagePreprocessing>
<filter>string</filter>
<imageMagickPath>string</imageMagickPath>
<language>string</language>
<maxFileSizeToOcr>0</maxFileSizeToOcr>
<minFileSizeToOcr>0</minFileSizeToOcr>
<pageSegMode>string</pageSegMode>
<pageSeparator>string</pageSeparator>
<preserveInterwordSpacing>false</preserveInterwordSpacing>
<resize>0</resize>
<skipOcr>false</skipOcr>
<tessdataPath>string</tessdataPath>
<tesseractPath>string</tesseractPath>
<timeoutSeconds>0</timeoutSeconds>
</ocr>
<poolSize>0</poolSize>
<xmlParserPoolSize>0</xmlParserPoolSize>
</handler>
Properties
| Property | Type | Required | Default |
|---|---|---|---|
embedded | EmbeddedConfig | No | EmbeddedConfig |
errorsSaveDir | string | No | - |
grobid | GrobidConfig | No | GrobidConfig |
label | string | No | - |
ocr | OcrConfig | No | OcrConfig |
poolSize | integer | No | 0 |
xmlParserPoolSize | integer | No | - |
Property Details
embedded
How documents contained inside other documents are handled — the files in a zip, the attachments on an email, the images in a PDF. By default their content and metadata are merged into the containing document.
Set splitContentTypes to have a container's embedded documents become
documents in their own right, each going through the whole import cycle. Set
skipEmbeddedContentTypes or skipEmbeddedOfContentTypes to leave some of
them unparsed. See EmbeddedConfig.
errorsSaveDir
Directory where documents that fail to parse are copied, for inspection. Left unset, failures are logged but the document is not kept.
grobid
Optional Grobid service settings, for extracting structured metadata and text from scientific documents such as journal article PDFs. Disabled unless you enable it. See GrobidConfig.
label
An optional, user-supplied label for this step in the importer pipeline. It has no effect on processing — it exists purely to help identify this step, for example in large configurations or in the visual configurator.
ocr
Optional Tesseract settings, for
pulling text out of images and of documents containing images — scanned PDFs,
TIFF archives, screenshots. Tesseract is not bundled: install it separately and
point ocr.tesseractPath at it, and OCR stays inactive until you do.
Once active, OCR is attempted on every supported image format (TIFF, PNG, JPEG, GIF, BMP, and images embedded in documents). It is slow next to text extraction, so restricting it by content type and file size is usually worth doing. All settings are described under OcrConfig.
poolSize
Maximum number of top-level documents the handler parses at once. The default,
0, sets no limit. Negative values are invalid.
When that many documents are already being parsed, the next one waits for one of them to finish. Embedded documents count as part of their container, so they never wait on it. Closing the handler wakes waiting callers with an error.
For example, "poolSize": 2 allows two parses at once per handler while other
crawler threads fetch documents or run other handlers, which keeps parsing-heavy
documents (large PDFs, OCR) from taking every thread. All documents share the same
Tika parser whatever the size, so a limit costs no memory.
xmlParserPoolSize
Optional positive size of Tika's pool of reusable SAX parsers and DOM builders,
used to parse XML-based formats (HTML, XHTML, Office Open XML, ...). Omitting the
setting leaves Tika's size as it is, 10 by default. When more documents than that
are parsed at once, Tika logs "Contention waiting for a SAXParser" and builds a
throwaway parser for each extra document, so a crawl using more threads than the
pool size gains from setting it to at least its number of threads.
The pool is shared by the whole JVM, and the largest size any handler asks for
wins: the first explicit size is applied as is, later ones can only make it
larger. This setting is independent of poolSize.