You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Mike Beckerle (Jira)" <ji...@apache.org> on 2023/04/15 16:13:00 UTC

[jira] [Commented] (DAFFODIL-2808) Incorrect Validation Error on Optional Element with Children

    [ https://issues.apache.org/jira/browse/DAFFODIL-2808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17712677#comment-17712677 ] 

Mike Beckerle commented on DAFFODIL-2808:
-----------------------------------------

Is this only a validation error when doing Daffodil's Limited validation? I'm going to assume so. This is Daffodil's check, not Xerces check. 

I believe when we set daffodil validation "on" it does BOTH the limited daffodil-code-base validation and feeds the output XML to Xerces for separate validation. 

Specifically, if we turn off all Daffodil validation, but a separate Xerces validator validates the XML, then I assume this would not be an issue.

But that's only true if nobody is calling dfdl:checkConstraints which invokes daffodil's facet validation (and max/min occurs validation? - tbd)

In your scenario, is checkConstraints being used? If so, can you avoid that? (I.e., is that a usable workaround?)

> Incorrect Validation Error on Optional Element with Children
> ------------------------------------------------------------
>
>                 Key: DAFFODIL-2808
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2808
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End
>    Affects Versions: 3.5.0
>            Reporter: Olabusayo Kilo
>            Priority: Major
>         Attachments: optionElementTest.scala, optionalElement.tdml
>
>
> When you have an optional element with children element, daffodil calculates the number of occurrences it has by looking at the number of children it has, rather than calculating the number of times it appears. This results in an validation error saying the element occurred NUM_OF_CHILDREN_TIME when it was expected.
> Attached is a TDML test that shows this incorrect validation error
> I narrowed down the  error to src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SequenceChildBases.scala line 543 in endArray
> {code:scala}
>         val occurrence = {
>           val maybeLastChild = state.infoset.maybeLastChild
>           if (maybeLastChild.isEmpty || maybeLastChild.get.erd != erd)
>             0
>           else
>             maybeLastChild.get.numChildren
>         }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)