stevedlawrence commented on issue #984:
URL: 
https://github.com/apache/daffodil-vscode/issues/984#issuecomment-1973537360

   Daffodil doesn't really have a way good way to query for all global 
elements. You could potentially create `ProcessorFactory` without specifying a 
root name/namespace (e.g. `Compiler.compileFile("path/to/schema.dfdl.xsdf")`, 
and then query members of its `SchemaSet` to find all possible global element 
declarations and their namespace, similar to this:
   
   
https://github.com/apache/daffodil/blob/main/daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/SchemaSet.scala#L380-L382
   
   But that's diving pretty deep into the Daffodil internals and probably isn't 
recommended.
   
   Probably the easiest approach is to just scan the main schema for global 
element declarations yourself (e.g. find `xs:element`'s that are immediate 
children of the `xs:schema`, and suggest those as possible roots. And the 
suggested namespace is just the `targetNmespace` property.
   
   Technically the root element could come from any included/imported schema, 
but that's pretty uncommon--the root almost always comes from the primary 
schema. And you probably wouldn't want to suggest all those imported global 
element declarations anyways because there are often a bunch of them them and 
it would just be confusing to users.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to