mbeckerle commented on issue #850:
URL: 
https://github.com/apache/daffodil-vscode/issues/850#issuecomment-1717572536

   The "xpath" expressions are not exactly XPath, but DFDL's variant thereof, 
(which we sometimes unoffically call DPath).
   
   They can reference variables defined by the DFDL schemas themselves as in 
the $prefix:variableName notation you've seen. These are defined via the 
dfdl:defineVariable construct. Those declarations most commonly come from 
include/imports of the schema. Like you can't just search backward in the text 
and hope to find them. It requires a "whole schema" model to know if they are 
properly spelled or not. 
   
   Short term I think the best you can do is recognize $, which introduces a 
variable, and parse the prefix and be sure there is a namespace binding for the 
prefix, and leave it at that. 
   
   Longer term, you want Daffodil to give you an error message that the 
variable name is unknown in order to know if it should be marked as an error or 
not. This requires compiling the schema. (Or at least part of compiling it. And 
we should be discussing what services Daffodil needs to provide to the IDE so 
that it can do this sort of semantic highlighting of compilation errors, such 
as expressions that are not properly typed.)
   
   There are 4 built in DFDL variables. They use $dfdl:byteOrder style 
notation. They're defined in section 7.7.1.2 of the spec.
   
   Whether a variable is external or not wouldn't affect the IDE display or 
not. External variables can just be bound by config files or the API before 
running a parse/unparse where non-external variables are for private use within 
the schema only, but either way users can misspell their names, etc.
   
   These are the 4 built-in predefined variables:
   
   dfdl:encoding 
   dfdl:byteOrder 
   dfdl:binaryFloatRep 
   dfdl:outputNewLine 
   
   
   
   


-- 
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