An integer which is the alignment of this term.
An integer which is the alignment of this term. This takes into account the representation, type, charset encoding and alignment-related properties.
Anything annotated must be able to construct the appropriate DFDLAnnotation object from the xml.
Anything annotated must be able to construct the appropriate DFDLAnnotation object from the xml.
The DFDL annotations on the component, as objects that are subtypes of DFDLAnnotation.
The DFDL annotations on the component, as objects that are subtypes of DFDLAnnotation.
overridden in LocalElementGrammarMixin
overridden in LocalElementGrammarMixin
Provides unordered sequence checks.
Provides unordered sequence checks. Will SDE if invalid.
check for overlap.
check for overlap.
Set of elements referenced from an expression in the scope of this term.
Set of elements referenced from an expression in the scope of this term.
Specific to certain function call contexts e.g., only elements referenced by dfdl:valueLength or dfdl:contentLength.
Separated by parser/unparser since parsers have to derive from dfdl:inputValueCalc, and must include discriminators and assert test expressions. Unparsers must derive from dfdl:outputValueCalc and exclude discriminators and asserts. Both must include setVariable/newVariableInstance, and property expressions are nearly the same. There are some unparser-specfic properties that take runtime-valued expressions - dfdl:outputNewLine is one example.
Any element referenced from an expression in the scope of this term is in this set.
Any element referenced from an expression in the scope of this term is in this set.
Always false as model groups can't be elements.
Always false as model groups can't be elements.
True if this term is known to have some text aspect.
True if this term is known to have some text aspect. This can be the value, or it can be delimiters.
False only if this term cannot ever have text in it. Example: a sequence with no delimiters. Example: a binary int with no delimiters.
Note: this is not recursive - it does not roll-up from children terms. TODO: it does have to deal with the prefix length situation. The type of the prefix may be textual.
Override in element base to take simple type or prefix length situations into account
Mandatory text alignment for delimiters
Mandatory text alignment for delimiters
Here we establish an invariant which is that every annotatable schema component has, definitely, has an annotation object.
Here we establish an invariant which is that every annotatable schema component has, definitely, has an annotation object. It may have no properties on it, but it will be there. Hence, we can delegate various property-related attribute calculations to it.
To realize this, every concrete class must implement (or inherit) an implementation of emptyFormatFactory, which constructs an empty format annotation, and isMyFormatAnnotation which tests if an annotation is the corresponding kind.
Given that, formatAnnotation then either finds the right annotation, or constructs one, but our invariant is imposed. There *is* a formatAnnotation.
The enclosing component, and follows back-references from types to their elements, from globalElementDef to elementRefs, from simpleType defs to derived simpletype defs, from global group defs to group refs
The enclosing component, and follows back-references from types to their elements, from globalElementDef to elementRefs, from simpleType defs to derived simpletype defs, from global group defs to group refs
Note: the enclosing component of a global element or global group referenced from a element ref or group ref, is NOT the ref object, but the component that contains the ref object
Define this for schema components that have back-references to ref objects.
Define this for schema components that have back-references to ref objects. So group def to group ref, globalelementdecl to element ref, type to element, base type to derived type.
Not for format annotations however. We don't backpoint those to other format annotations that ref them.
This is only the immediately enclosing model group.
This is only the immediately enclosing model group. It doesn't walk outward.
All schema components except the root have an enclosing element.
All schema components except the root have an enclosing element.
Does lookup of property using DFDL scoping rules, checking first non-default properties, then default property locations.
Does lookup of property using DFDL scoping rules, checking first non-default properties, then default property locations.
Use this when you want to know if a property is defined exactly on a component.
Use this when you want to know if a property is defined exactly on a component. This ignores any default properties or properties defined on element references. For example, if you want to know if a property was defined on a global element decl rather than an element reference to that decl.
For unit testing, we want to create GrammarMixin objects that are not schema components.
For unit testing, we want to create GrammarMixin objects that are not schema components. So we can't use a self-type here. Instead we define this abstract grammarContext.
Returns the group members that are elements or model groups.
Returns the group members that are elements or model groups.
True if this term has initiator, terminator, or separator that are either statically present, or there is an expression.
True if this term has initiator, terminator, or separator that are either statically present, or there is an expression. (Such expressions are not allowed to evaluate to "" - you can't turn off a delimiter by providing "" at runtime. Minimum length is 1 for these at runtime.
Override in SequenceTermBase to also check for separator.
These are static properties even though the delimiters can have runtime-computed values.
These are static properties even though the delimiters can have runtime-computed values. The existence of an expression to compute a delimiter is assumed to imply a non-zero-length, aka a real delimiter.
no alignment properties that would explicitly create a need to align in a way that is not on a suitable boundary for a character.
no alignment properties that would explicitly create a need to align in a way that is not on a suitable boundary for a character.
We want to determine if we're in an unordered sequence at any point along our parents.
We want to determine if we're in an unordered sequence at any point along our parents.
An array can have more than 1 occurrence.
An array can have more than 1 occurrence.
An optional element (minOccurs=0, maxOccurs=1) is an array only if occursCountKind is parsed, because then the max/min are ignored.
Whether the component is hidden.
Whether the component is hidden.
Override this in the components that can hide - SequenceGroupRef and ChoiceGroupRef
Character encoding common attributes
Character encoding common attributes
Note that since encoding can be computed at runtime, we create values to tell us if the encoding is known or not so that we can decide things at compile time when possible.
Conservatively determines if this term is known to have the same bit order as the previous thing.
Conservatively determines if this term is known to have the same bit order as the previous thing.
If uncertain, returns false.
true if we can statically determine that the start of this will be properly aligned by where the prior thing left us positioned.
true if we can statically determine that the start of this will be properly aligned by where the prior thing left us positioned. Hence we are guaranteed to be properly aligned.
True if this element itself consists only of text.
True if this element itself consists only of text. No binary stuff like alignment or skips.
Not recursive into contained children.
Determines if the element is optional, as in has zero or one instance only.
Determines if the element is optional, as in has zero or one instance only.
There are two senses of optional
1) Optional as in "might not be present" but for any reason. Consistent with this is Required meaning must occur (but for any reason. So all the occurrences of an array that has fixed number of occurrences are required, and some of the occurrances of an array that has a variable number of occurrences are optional.
2) Optional is in minOccurs="0" maxOccurs="1".
Consistent with (2) is defining array as maxOccurs >= 2, and Required as minOccurs=maxOccurs=1, but there are also special cases for occursCountKind parsed and stopValue since they don't examine min/max occurs - they are only used for validation in those occursCountKinds.
The DFDL spec is not entirely consistent here either I don't believe.
Overridden as false for elements with dfdl:inputValueCalc property.
Overridden as false for elements with dfdl:inputValueCalc property.
Something is required if it is not optional and not an array, unless that array has required elements.
Something is required if it is not optional and not an array, unless that array has required elements.
A scalar means has no dimension.
A scalar means has no dimension. Exactly one occurrence.
Since terms include both model groups and elements, in DFDL v1.0, model groups are always scalar, as DFDL v1.0 doesn't allow min/max occurs on model groups.
True if it is sensible to scan this data e.g., with a regular expression.
True if it is sensible to scan this data e.g., with a regular expression. Requires that all children have same encoding as enclosing groups and elements, requires that there is no leading or trailing alignment regions, skips. We have to be able to determine that we are for sure going to always be properly aligned for text.
Caveat: we only care that the encoding is the same if the term actually could have text (couldHaveText is an LV) as part of its representation. For example, a sequence with no initiator, terminator, nor separators can have any encoding at all, without disqualifying an element containing it from being scannable. There has to be text that would be part of the scan.
If the root element isScannable, and encodingErrorPolicy is 'replace', then we can use a lower-overhead I/O layer - basically we can use a java.io.InputStreamReader directly.
We are going to depend on the fact that if the encoding is going to be this X-DFDL-US-ASCII-7-BIT-PACKED thingy (7-bits wide code units, so aligned at 1 bit) that this encoding must be specified statically in the schema.
If an encoding is determined at runtime, then we will insist on it being 8-bit aligned code units.
When the encoding is known, this tells us the mandatory alignment required.
When the encoding is known, this tells us the mandatory alignment required. This is always 1 or 8.
Annotations can contain expressions, so we need to be able to compile them.
Annotations can contain expressions, so we need to be able to compile them.
We need our own instance so that the expression compiler has this schema component as its context.
Use when we might or might not need the outputNewLine property
Use when we might or might not need the outputNewLine property
Mandatory text alignment or mta
Mandatory text alignment or mta
mta can only apply to things with encodings. No encoding, no MTA.
In addition, it has to be textual data. Just because there's an encoding in the property environment shouldn't get you an MTA region. It has to be textual.
Namespace scope for resolving QNames.
Namespace scope for resolving QNames.
We insist that the prefix "xsi" is properly defined for use in xsi:nil attributes, which is how we represent nilled elements when we convert to XML.
nearestEnclosingSequence
nearestEnclosingSequence
An attribute that looks upward to the surrounding context of the schema, and not just lexically surrounding context. It needs to see what declarations will physically surround the place. This is the dynamic scope, not just the lexical scope. So, a named global type still has to be able to ask what sequence is surrounding the element that references the global type.
This is why we have to have the GlobalXYZDefFactory stuff. Because this kind of back pointer (contextual sensitivity) prevents sharing.
Used as factory for the XML Node with the right namespace and prefix etc.
Used as factory for the XML Node with the right namespace and prefix etc.
Given "element" it creates <dfdl:element /> with the namespace definitions based on this schema component's corresponding XSD construct.
Makes sure to inherit the scope so we have all the namespace bindings.
Combine our statements with those of what we reference.
Combine our statements with those of what we reference. Elements reference types ElementRefs reference elements, etc.
The order here is important. The statements from type come first, then from declaration, then from reference.
Changed to use findProperty, and to resolve the namespace properly.
Changed to use findProperty, and to resolve the namespace properly.
We lookup a property like escapeSchemeRef, and that actual property binding can be local, in scope, by way of a format reference, etc.
It's value is a QName, and the definition of the prefix is from the location where we found the property, and NOT where we consume the property.
Hence, we resolve w.r.t. the location that provided the property.
The point of findProperty vs. getProperty is just that the former returns both the value, and the object that contained it. That object is what we resolve QNames with respect to.
Note: Same is needed for properties that have expressions as their values. E.g., consider "{ ../foo:bar/.. }". That foo prefix must be resolved relative to the object where this property was written, not where it is evaluated. (JIRA issue DFDL-77)
The lexically enclosing schema component
The lexically enclosing schema component
path is used in diagnostic messages and code debug messages; hence, it is very important that it be very dependable.
path is used in diagnostic messages and code debug messages; hence, it is very important that it be very dependable.
Returns tuple, where the first is children that could be last, and the second is a boolean if all children could be optional, and thus this could be last
Returns tuple, where the first is children that could be last, and the second is a boolean if all children could be optional, and thus this could be last
Returns a tuple, where the first item in the tuple is the list of sibling terms that could appear before this.
Returns a tuple, where the first item in the tuple is the list of sibling terms that could appear before this. The second item in the tuple is a One(parent) if all siblings are optional or this element has no prior siblings
Use when production has no guard, but you want to name the production anyway (for debug visibility perhaps).
Use when production has no guard, but you want to name the production anyway (for debug visibility perhaps).
Use when production has a guard predicate
Use when production has a guard predicate
Convenience method to make gathering up all elements referenced in expressions easier.
Convenience method to make gathering up all elements referenced in expressions easier.
For property combining only.
For property combining only. E.g., doesn't refer from an element to its complex type because we don't combine properties with that in DFDL v1.0. (I consider that a language design bug in DFDL v1.0, but that is the way it's defined.)
Returns the property resolver for this component.
Returns the property resolver for this component.
ALl non-terms get runtimeData from this definition.
ALl non-terms get runtimeData from this definition. All Terms which are elements and model-groups) override this.
The Term class has a generic termRuntimeData => TermRuntimeData function (useful since all Terms share things like having charset encoding) The Element classes all inherit an elementRuntimeData => ElementRuntimeData and the model groups all have modelGroupRuntimeData => ModelGroupRuntimeData.
There is also VariableRuntimeData and SchemaSetRuntimeData.
Includes instances.
Includes instances. Ie., a global element will appear inside an element ref. a global group inside a group ref, a global type inside an element or for derived simple types inside another simple type, etc.
Used in diagnostic messages and code debug messages
separator combinators - detect cases where no separator applies.
separator combinators - detect cases where no separator applies. Note that repeating elements are excluded because they have to managed their own separatedForArrayPosition inside the repetition.
Elements only e.g., /foo/ex:bar
Elements only e.g., /foo/ex:bar
Roll up from the bottom.
Roll up from the bottom. This is abstract interpretation. The top (aka conflicting encodings) is "mixed" The bottom is "noText" (combines with anything) The values are encoding names, or "runtime" for expressions.
By doing expression analysis we could do a better job here and determine when things that use expressions to get the encoding are all going to get the same expression value. For now, if it is an expression then we lose.
This is the root, or basic target namespace.
This is the root, or basic target namespace. Every schema component gets its target namespace from its xmlSchemaDocument.
Returns the Term corresponding to this component.
Returns the Term corresponding to this component.
The termChildren are the children that are Terms, i.e., derived from the Term base class.
The termChildren are the children that are Terms, i.e., derived from the Term base class. This is to make it clear we're not talking about the XML structures inside the XML parent (which might include annotations, etc.
For elements this is Nil for simple types, a single model group for complex types. For model groups there can be more children.
Used in diagnostic messages; hence, valueOrElse to avoid problems when this can't get a value due to an error.
Used in diagnostic messages; hence, valueOrElse to avoid problems when this can't get a value due to an error.
Any element referenced from an expression in the scope of this term is in this set.
Any element referenced from an expression in the scope of this term is in this set.
Any element referenced from an expression in the scope of this term is in this set.
Any element referenced from an expression in the scope of this term is in this set.
Represents a local sequence definition.