The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

Data::Edit::Xml::Xref - Cross reference Dita XML.

Synopsis

Check the references in a set of Dita XML documents held in folder inputFolder:

  use Data::Edit::Xml::Xref;

  my $x = xref(inputFolder=>q(in));
  ok $x->statusLine =~ m(\AXref Errors: 56 bad xrefs, 8 bad conrefs, 2 bad topicrefs, 8 missing images, 8 duplicate ids, 11 bad first lines, 11 bad second lines\Z);
    Xref Errors: 1 file failed to parse, 48 bad xrefs, 8 bad conrefs,
    2 bad topicrefs, 7 missing image refs, 1 image file found,
    7 missing image files, 8 duplicate ids, 11 bad first lines,
    11 bad second lines\Z);

More detailed reports are produced in the reports folder:

  $x->reports

Description

Cross reference Dita XML.

Version 20181030.

The following sections describe the methods in each functional area of this module. For an alphabetic listing of all methods by name see Index.

Cross reference

Check the cross references in a set of Dita files and report the results.

xref(%)

Check the cross references in a set of Dita files held in inputFolder and report the results in the reports folder. The possible atributes are defined in Data::Edit::Xml::Xref

     Parameter    Description
  1  %attributes  Attributes

Example:

    my $x = 𝘅𝗿𝗲𝗳(inputFolder=>q(in), maximumNumberOfProcesses=>16);               
  

Hash Definitions

Data::Edit::Xml::Xref Definition

Attributes used by cross referencer.

badConRefs - [file, href] Invalid conref attributes.

badImageRefs - [file, href] Missing images.

badTopicRefs - [file, href] Invalid href attributes topicref tags.

badXRefs - [file, href] Invalid href attributes on xref tags.

badXml1 - Files with a bad xml encoding header on the first line.

badXml2 - Files with a bad xml doc type on the second line.

conRefs - {file}{id}++ Conref definitions.

duplicateIds - [file, id] Duplicate id definitions within a file.

duplicateTopicIds - [topicId, [files]] Files with duplicate topic ids

ids - {file}{id}++ Id definitions across all files.

images - {file}{href}++ Images references.

imagesFound - Consolidated images found

imagesMissing - Consolidated images missing

inputFiles - Input files from inputFolder.

inputFolder - A folder containing the dita and ditamap files to be cross referenced.

maximumNumberOfProcesses - Maximum number of processes to run

parseFailed - [file] files that failed to parse

reports - Reports folder: the cross referencer will write reports to files in this folder.

results - Results table

statusLine - Status line summarizing the cross reference.

summary - Print the summary line.

topicIds - {file} = topic id

topicRefs - {file}{href}++ Topic references.

xRefs - {file}{href}++ Xrefs references.

Private Methods

loadInputFiles($)

Load the names of the files to be processed

     Parameter  Description
  1  $xref      Cross referencer

analyzeOneFile($)

Analyze one input file

     Parameter  Description
  1  $iFile     File to analyze

analyze($)

Analyze the input files

     Parameter  Description
  1  $xref      Cross referencer

reportDuplicateIds($)

Report duplicate ids

     Parameter  Description
  1  $xref      Cross referencer

reportBadRefs($$)

Report bad references found in xrefs or conrefs as they have the same structure

     Parameter  Description
  1  $xref      Cross referencer
  2  $type      Type of reference to be processed

reportBadXrefs($)

Report bad xrefs

     Parameter  Description
  1  $xref      Cross referencer

reportBadTopicRefs($)

Report bad topic refs

     Parameter  Description
  1  $xref      Cross referencer

reportBadConrefs($)

Report bad conrefs refs

     Parameter  Description
  1  $xref      Cross referencer

reportImages($)

Reports on images and references to images

     Parameter  Description
  1  $xref      Cross referencer

reportParseFailed($)

Report failed parses

     Parameter  Description
  1  $xref      Cross referencer

reportBadXml1($)

Report bad xml on line 1

     Parameter  Description
  1  $xref      Cross referencer

reportBadXml2($)

Report bad xml on line 2

     Parameter  Description
  1  $xref      Cross referencer

createSampleInputFiles($)

Create sample input files for testing. The attribute inputFolder supplies the name of the folder in which to create the sample files.

     Parameter  Description
  1  $N         Number of sample files

Index

1 analyze - Analyze the input files

2 analyzeOneFile - Analyze one input file

3 createSampleInputFiles - Create sample input files for testing.

4 loadInputFiles - Load the names of the files to be processed

5 reportBadConrefs - Report bad conrefs refs

6 reportBadRefs - Report bad references found in xrefs or conrefs as they have the same structure

7 reportBadTopicRefs - Report bad topic refs

8 reportBadXml1 - Report bad xml on line 1

9 reportBadXml2 - Report bad xml on line 2

10 reportBadXrefs - Report bad xrefs

11 reportDuplicateIds - Report duplicate ids

12 reportImages - Reports on images and references to images

13 reportParseFailed - Report failed parses

14 xref - Check the cross references in a set of Dita files held in inputFolder and report the results in the reports folder.

Installation

This module is written in 100% Pure Perl and, thus, it is easy to read, comprehend, use, modify and install via cpan:

  sudo cpan install Data::Edit::Xml::Xref

Author

philiprbrenan@gmail.com

http://www.appaapps.com

Copyright

Copyright (c) 2016-2018 Philip R Brenan.

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.