Hoist that element (which is common to both branches) to before the choice
so there is only one instance of it, and the problem will go away.

That workaround is easy and that's why we have not prioritized a possible
optimization which would do this hoist automatically.

This principle will keep you out of trouble: Path expressions need to refer
to an element that has exactly one element declaration in the schema.

(... and note that sharing the element declaration via a group definition
and multiple group references doesn't count. Think of group references as
if they were copying the group.)




On Thu, Jan 11, 2024 at 3:52 AM Roger L Costello <coste...@mitre.org> wrote:

> Hi Folks,
>
>
>
> I tried Mike’s suggestion to avoid the UPA error: precede the element with
> a uniquely named empty element, e.g.,
>
>
>
> <xs:element name="record">
>     <xs:complexType>
>         <xs:sequence>
>             <xs:element name="Section_Code" type="fixedLength_string"
> dfdl:length="1"/>
>             <xs:choice dfdl:choiceDispatchKey="{Section_Code}">
>                 <xs:sequence dfdl:choiceBranchKey="D">
>                     <xs:element name="Unique_Name_1" type="xs:string"
> dfdl:lengthKind="explicit" dfdl:length="0"/>
>                     <xs:element name="Subsection_Code" type=
> "fixedLength_string" dfdl:length="1"/>
>                 </xs:sequence>
>                 <xs:sequence dfdl:choiceBranchKey="E">
>                     <xs:element name="Unique_Name_2" type="xs:string"
> dfdl:lengthKind="explicit" dfdl:length="0"/>
>                     <xs:element name="Subsection_Code" type=
> "fixedLength_string" dfdl:length="1"/>
>                 </xs:sequence>
>             </xs:choice>
>         </xs:sequence>
>     </xs:complexType>
> </xs:element>
>
>
>
> However, that results in Daffodil generating these warning messages:
>
>
>
> *[warn] Schema Definition Warning: Statically ambiguous or query-style
> paths not supported in step path: '{}Subsection_Code'. Matches are at
> locations: …*
>
>
>
> What is that all about? How to get rid of them?
>
>
>
> /Roger
>

Reply via email to