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

Mike Beckerle commented on DAFFODIL-2115:
-----------------------------------------

This issue is about namespace prefixes, so I'm changing the title to reflect 
that. 

The challenge here is that 'tns' is suggested as a prefix for the user to try, 
when that prefix isn't available in the scope where the reference is being made.

So the problem is that the diagnostic message is taking the prefix suggestions 
from the scope of where the element is defined, not where the scope is being 
referenced.

The 'tns' convention is something we used for a while, and some people do like, 
but it is no longer suggested practice due to this sort of thing where a 
multi-schema file with lots of different namespaces it becomes unclear "which 
tns are you talking about?".

But in this case, the diagnostic message needs to be using the namespace scope 
where that path expression with the "/a_element" step occurs, and furthermore, 
unless "tns" is the only prefix, some other prefix should be used instead.  In 
general there can be many prefix bindings for the same namespace URI, and 
Daffodil is no doubt taking which ever one the API gives back. But it needs to 
offer all the prefixes that are for the right target namespace, or it needs to 
choose one by heuristic which excludes "tns" if possible. 

> Incorrect prefix suggested for bad steps in DPath paths
> -------------------------------------------------------
>
>                 Key: DAFFODIL-2115
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2115
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Diagnostics
>            Reporter: Brandon Sloane
>            Priority: Minor
>         Attachments: a.dfdl.xsd, b.dfdl.xsd
>
>
> Consider the following (incorrect) DFDL snippet:
>  
> {quote}<xs:element name="root" dfdl:lengthKind="implicit">
>  <xs:complexType>
>  <xs:sequence>
>  <xs:element ref="a:a_element" />
>  <xs:element name="b" type="tns:b_type" dfdl:inputValueCalc="\{ ../a_element 
> }" />
>  </xs:sequence>
>  </xs:complexType>
>  </xs:element>
> {quote}
> Note that the dfdl:inputValueCalc should specify the namespace of the element 
> it is referring to "a:a_element".
> In attempting to compile the above, Daffodil reports the error as:
> {quote}[error] Schema Definition Error: No element corresponding to step 
> {}a_element found. Possibilities for this step include: tns:a_element, {}b.
> {quote}
> Following Daffodils advice, results in a more reasonable suggestion:
>  
> {quote}
> [error] Schema Definition Error: No element corresponding to step 
> tns:a_element found,but elements with the same local name were found 
> (a:a_element).Perhaps a prefix is incorrect or missing on the step name?
> {quote}
>  
> Schema needed to reproduce is attached. Reproduce with:
> {quote}daffodil save-parser -s b.dfdl.xsd parser.bin
> {quote}



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

Reply via email to