-
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
base: main
Are you sure you want to change the base?
Fix Ignored RootNS #1367
Conversation
- currently we find the root element using only the local name of an element, this can result in ambiguous roots and an error if you have an element with no namespace and one with a namespace. This PR fixes that by searching using the qname instead - add search for qname option if no namespace is specified, because there might still be an unambiguous root element within a namespace, the user just opted not to specify it DAFFODIL-2947
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.
+1 minor suggestion for doc to add.
if (possibleRoots.length == 1) { | ||
possibleRoots.head | ||
} else { | ||
val qn = RefQName(None, rootElementName, NoNamespace) |
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.,
It's ambiguous what root element, and no namespace URI was provided.
So we assume not specifying a namespace URI may mean the intention
was to choose the root that it is in No Namespace.
If there is no such, then the diagnostic will encourage user to specify
the namespace explicitly.
<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 comment
The 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.
- add doc comment - update test names DAFFODIL-2947
- use Schemas.searchGlobalElementDecl instead of duplicating effort DAFFODIL-2947
DAFFODIL-2947