-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Ignored RootNS #1367
Open
olabusayoT
wants to merge
3
commits into
apache:main
Choose a base branch
from
olabusayoT:daf-2947-rootNSAmbiguousRootElements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix Ignored RootNS #1367
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
daffodil-tdml-processor/src/test/resources/test/tdml/chameleon-schema1.dfdl.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"> | ||
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> | ||
<xs:import namespace="urn:schema:namespace" schemaLocation="/test/tdml/generic-schema1.dfdl.xsd"/> | ||
|
||
<xs:annotation> | ||
<xs:appinfo source="http://www.ogf.org/dfdl/"> | ||
<dfdl:format ref="GeneralFormat"/> | ||
</xs:appinfo> | ||
</xs:annotation> | ||
|
||
<xs:element name="data" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/> | ||
</xs:schema> |
28 changes: 28 additions & 0 deletions
28
daffodil-tdml-processor/src/test/resources/test/tdml/generic-schema1.dfdl.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<xs:schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
xmlns:ex="http://example.com" xmlns:s="urn:schema:namespace" targetNamespace="urn:schema:namespace" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"> | ||
<xs:include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> | ||
<xs:annotation> | ||
<xs:appinfo source="http://www.ogf.org/dfdl/"> | ||
<dfdl:format ref="s:GeneralFormat"/> | ||
</xs:appinfo> | ||
</xs:annotation> | ||
|
||
<xs:element name="data" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 3 }"/> | ||
</xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -608,4 +608,80 @@ abc # a comment | |
@Test def test_apos_test1(): Unit = { runner.runOneTest("apos_test1") } | ||
@Test def test_apos_test2(): Unit = { runner.runOneTest("apos_test2") } | ||
|
||
// DFDL-2947 | ||
@Test def test_rootNSSpecifiesNoNamespaceRoot(): Unit = { | ||
val tdmlTestSuite = | ||
<tdml:testSuite suiteName="theSuiteName" xmlns:ex={example} xmlns:tdml={tdml} xmlns:dfdl={ | ||
dfdl | ||
} xmlns:xsd={xsd} xmlns:xs={xsd} xmlns:xsi={xsi}> | ||
<tdml:parserTestCase name="test1" root="data" rootNS="" model="/test/tdml/chameleon-schema1.dfdl.xsd"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe rename test to reflect that rootNS is being used to specify no namespace. It's not only multiple root candidates but that one of them is no namespace, and this illustrates how to specify that. |
||
<tdml:document>37</tdml:document> | ||
<tdml:infoset> | ||
<tdml:dfdlInfoset> | ||
<data>37</data> | ||
</tdml:dfdlInfoset> | ||
</tdml:infoset> | ||
</tdml:parserTestCase> | ||
</tdml:testSuite> | ||
|
||
val runner = new Runner(tdmlTestSuite) | ||
runner.runOneTest("test1") | ||
} | ||
|
||
@Test def test_rootNSSpecifiesNamespaceRoot(): Unit = { | ||
val tdmlTestSuite = | ||
<tdml:testSuite suiteName="theSuiteName" xmlns:ex={example} xmlns:tdml={tdml} xmlns:dfdl={ | ||
dfdl | ||
} xmlns:xsd={xsd} xmlns:xs={xsd} xmlns:xsi={xsi}> | ||
<tdml:parserTestCase name="test1" root="data" rootNS="urn:schema:namespace" model="/test/tdml/chameleon-schema1.dfdl.xsd"> | ||
<tdml:document>boy</tdml:document> | ||
<tdml:infoset> | ||
<tdml:dfdlInfoset> | ||
<data>boy</data> | ||
</tdml:dfdlInfoset> | ||
</tdml:infoset> | ||
</tdml:parserTestCase> | ||
</tdml:testSuite> | ||
|
||
val runner = new Runner(tdmlTestSuite) | ||
runner.runOneTest("test1") | ||
} | ||
|
||
@Test def test_noRootCandidates1(): Unit = { | ||
val tdmlTestSuite = | ||
<tdml:testSuite suiteName="theSuiteName" xmlns:ex={example} xmlns:tdml={tdml} xmlns:dfdl={ | ||
dfdl | ||
} xmlns:xsd={xsd} xmlns:xs={xsd} xmlns:xsi={xsi}> | ||
<tdml:parserTestCase name="test1" root="data1" model="/test/tdml/chameleon-schema1.dfdl.xsd"> | ||
<tdml:document>37</tdml:document> | ||
<tdml:errors> | ||
<tdml:error>Schema Definition Error</tdml:error> | ||
<tdml:error>no root element found</tdml:error> | ||
<tdml:error>data1</tdml:error> | ||
</tdml:errors> | ||
</tdml:parserTestCase> | ||
</tdml:testSuite> | ||
|
||
val runner = new Runner(tdmlTestSuite) | ||
runner.runOneTest("test1") | ||
} | ||
|
||
@Test def test_noRootCandidates2(): Unit = { | ||
val tdmlTestSuite = | ||
<tdml:testSuite suiteName="theSuiteName" xmlns:ex={example} xmlns:tdml={tdml} xmlns:dfdl={ | ||
dfdl | ||
} xmlns:xsd={xsd} xmlns:xs={xsd} xmlns:xsi={xsi}> | ||
<tdml:parserTestCase name="test1" root="data" rootNS="doesNotExist" model="/test/tdml/chameleon-schema1.dfdl.xsd"> | ||
<tdml:document>37</tdml:document> | ||
<tdml:errors> | ||
<tdml:error>Schema Definition Error</tdml:error> | ||
<tdml:error>no global element found</tdml:error> | ||
<tdml:error>{"{doesNotExist}"}data</tdml:error> | ||
</tdml:errors> | ||
</tdml:parserTestCase> | ||
</tdml:testSuite> | ||
|
||
val runner = new Runner(tdmlTestSuite) | ||
runner.runOneTest("test1") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some comments explaining the rationale here. E.g.,