You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Steve Lawrence (Jira)" <ji...@apache.org> on 2021/02/01 14:00:01 UTC

[jira] [Commented] (DAFFODIL-913) A global element is incorrectly required for all schemas

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

Steve Lawrence commented on DAFFODIL-913:
-----------------------------------------

I've confirmed that this is still the current behavior. Updated steps to reproduce:

# Fix the multi_A_21.dfdl.xsd to replace: {code:xml}<dfdl:format ref="base:GeneralFormat" ... />{code} with {code:xml}<dfdl:format ref="a21:GeneralFormat" ... />{code}
# Add daffodil-test resources to the Daffodil classpath so includes/imports can find some test files
{code:bash}
export DAFFODIL_CLASSPATH="/path/to/daffodil.git/daffodil-test/src/test/resources/"
{code}
# Run the following command:
{code:bash}
echo -n "foo" | daffodil parse -s /org/apache/daffodil/section06/namespaces/multi_base_21.dfdl.xsd
{code}

This results in the error:
{code}
[error] Schema Definition Error: No global elements in: file:/.../multi_base_21.dfdl.xsd
Schema context: SchemaSet Location in file:/.../multi_base_21.dfdl.xsd
{code}

Adding {{-r distant_element}} to the command in step 3 does allow this to work, so there is a pretty simple workaround to just specify the root element.

In fact, I wonder if we even want to fix this? The main schema does not have any global elements, only the included schema. Do we really want to scan included schemas, potentially nesting multiple levels deep, to find the first global element? Especially considering that order doesn't matter with inludes/imports, tring to figure out what the user intended is likely to cause issues. And this feels like a pretty rare edge case--I'm not sure how often users will have the main schema not have any global elements.

Should we just add some tests to confirm this is the correct behavior and resolve this?

> A global element is incorrectly required for all schemas
> --------------------------------------------------------
>
>                 Key: DAFFODIL-913
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-913
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Front End, General
>            Reporter: Steve Lawrence
>            Priority: Major
>              Labels: dev-verify
>
> Currently, if you have a schema that only includes complex types which are imported and used in other schemas, daffodil fails with an error stating:
> {quote}
> No global elements in foo.xsd
> {quote}
> This restriction should be removed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)