Project

Profile

Help

Bug #6085

closed

Incomplete path in error messages in validation report

Added by Tim Weisenberger over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2023-06-20
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

When using the validation with XSD in Saxon EE, in the case of erroneous attributes only the erroneous attribute is reported in the validation report, but not its associated node in the path. With this path, however, no distinct access via XPath to the erroneous node is possible. As an example for an erroneous path in the error nodes I have created the example below.

<?xml version="1.0" encoding="UTF-8"?>
<PIM>
    <category id="c-1" title="Products"/>
    <category id="c-2" title="Sub-Category"/>
    <category id="c-3" title=""/>
    <category id="c-4" title=""/>
</PIM>
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="PIM">
        <xs:complexType>
            <xs:sequence>
                <xs:choice maxOccurs="unbounded">
                    <xs:element name="category" type="categoryType"/>
                </xs:choice>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="categoryType">
        <xs:attribute name="id" type="xs:ID" use="required"/>
        <xs:attribute name="title" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:minLength value="1"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<validation-report xmlns="http://saxon.sf.net/ns/validation"
                    system-id="file:/example.xml">
   <error line="5"
           column="34"
           path="/Q{}PIM[1]/@title"
           xsd-part="2"
           constraint="cvc-complex-type.3">Value "" contravenes the minLength facet "1" of the type of attribute title</error>
   <error line="6"
           column="34"
           path="/Q{}PIM[1]/@title"
           xsd-part="2"
           constraint="cvc-complex-type.3">Value "" contravenes the minLength facet "1" of the type of attribute title</error>
   <meta-data>
      <validator name="SAXON-EE" version="12.2"/>
      <results errors="2" warnings="0"/>
      <schema file="/example.xsd"
               xsd-version="1.1"/>
      <run at="2023-06-20T06:25:13.022229341Z"/>
   </meta-data>
</validation-report>

For a distinct access to the erroneous node, I would expect the following path:

/Q{}PIM[1]/Q{}category[3]/@title

However, only the following path is provided:

/Q{}PIM[1]/@title

Please register to edit this issue

Also available in: Atom PDF