Skip to content

Resolve DTD for validation #51

@1stone

Description

@1stone

I'm trying to validate a bunch of XML files, organized in a multi-directory filesystem structure, against a DTD.

From what I understand from #46 and #47 that should still be possible with 1.0.2 if a DOCTYPE decl is present on the XML files.
So, given this definition in the XML files

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE acme PUBLIC "acme.dtd" "acme.dtd">
...

I would like to validate against that acme.dtd which is located in the root of the validationSet directory.
But unfortunately, the validation fails with While parsing /.../vroot/path/to/this.xml: /.../vroot/path/to/acme.dtd (No such file or directory), with vroot being the directory in the validationSet and where acme.dtd is located.

I tried to "register" the DTD file via a catalog setting, but to no avail.
Is there any way to configure the plugin in a way, that all XML files with DOCTYPE acme will be validated against the DTD file in the vroot?

This is the current plugin config for reference:

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>xml-maven-plugin</artifactId>
          <version>1.0.2</version>
          <configuration>
            <validationSets>
              <validationSet>
                <dir>${project.build.xml.directory}</dir>
                <validating>true</validating>
              </validationSet>
            </validationSets>
            <catalogs>
              <catalog>${project.build.xml.directory}/acme.dtd</catalog>
            </catalogs>
            <catalogHandling>strict</catalogHandling>
          </configuration>
        </plugin>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions