Web Connector 25.2
Web Connector Help

# Split Web Pages into Multiple Documents

You might want to split Web pages into multiple documents. For example, if you ingest pages from a discussion board you might want to ingest one document for each message on the page.

The Web Connector can create documents for sections of a Web page identified using CSS selectors. For each Web page, the connector creates a parent document and an associated file that contains the full page source. It then creates a child document for each section of the page. Each child document has an associated file that contains the `<head>` element from the original page, and a `<body>` element containing the content identified by your CSS selector. The parent document includes metadata fields (named `CHILD_DOCUMENT`) that refer to the child documents, and each child document has a metadata field (`PAGE_REFERENCE`) that refers back to the parent document.

To split Web pages into multiple documents

1. Stop the connector and open the configuration file.

2. Modify your fetch task by adding the following parameters:

   ChildDocumentSection | (Optional) A comma-separated list of sections in the Web Connector configuration file that contain settings for creating child documents. If you do not set this parameter, the connector uses the settings in the TaskName section.
   ChildDocumentUrlRegex | (Optional) A Perl-compatible regular expression to identify the pages to generate child documents from. The connector does not attempt to generate child documents from a page unless the full URL of a page matches the regular expression.
   ChildDocumentSelector | A CSS selector that identifies the root element of each child document in the page source.
   ChildReferenceSelector | (Optional) An element in the child document that contains a value to use as the document reference. The value you extract should be unique for each child document, because it is used as part of the `DREREFERENCE` field in the child document. If you do not set this parameter, the connector uses a GUID. Specify the element using a CSS selector, relative to the element identified by `ChildDocumentSelector`.

3. Save and close the configuration file.

## Example

Consider the following example page which represents messages on a page of a discussion board:

    <html>
        <head>
            <title>Example Page</title>
            <meta charset="utf-8">
        </head>
        <body>
            <div>
                <h1>Example Page</h1>
                <div class="content">
                    <p>content</p>
                </div>
                <div class="message">
                    <h1>Message 1</h1>
                    <p class="meta">some metadata</p>
                    <p>some content</p>
                </div>
                <div class="message">
                    <h1>Message 2</h1>
                    <p class="meta">some metadata</p>
                    <p>some content</p>
                </div>
                ...
            </div>
        </body>
    </html>

To create separate documents for the messages contained on this page, you could use the following configuration:

    [MyTask]
    ...
    ChildDocumentSelector=div.message
    ChildReferenceSelector=h1

This example would produce the following child document:

    #DREREFERENCE [child][Message 1]http://www.example.com/example.htm
    #DREFIELD PAGE_REFERENCE="http://www.example.com/example.htm"

The `PAGE_REFERENCE` field is added automatically by Web Connector and contains the reference of the parent document.

The following file is associated with the child document. The Web Connector includes the `<head>` element from the Web page and adds the content identified by `ChildDocumentSelector` to the `<body>` element. If you send your documents to CFS, this file is filtered by File Content Extraction and the information it contains is used as the document content.

    <html>
        <head>
            <title>Example Page</title>
            <meta charset="utf-8">
        </head>
        <body>
            <div class="message">
                <h1>Message 1</h1>
                <p class="meta">some metadata</p>
                <p>some content</p>
            </div>
        </body>
    </html>

A similar document and file would be ingested for the second message.

The parent document contains the full page content. The Web Connector automatically adds fields named `CHILD_DOCUMENT`, containing the references of associated child documents:

    #DREREFERENCE http://www.example.com/example.htm
    ...
    #DREFIELD CHILD_DOCUMENT="[child][Message 1]http://www.example.com/example.htm"
    #DREFIELD CHILD_DOCUMENT="[child][Message 2]http://www.example.com/example.htm"
    ...

Copyright 2025 Open Text
Version 25.2 | Last updated April 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Web Connector 25.2

Topic Title: Split Web Pages into Multiple Documents