stevedlawrence commented on code in PR #973:
URL: https://github.com/apache/daffodil/pull/973#discussion_r1118697652
##########
daffodil-test/src/test/resources/org/apache/daffodil/section23/dfdl_expressions/expressions_unused_path_no_context.dfdl.xsd:
##########
@@ -28,20 +28,119 @@
</xs:appinfo>
</xs:annotation>
+
<xs:element name="e1" type="xs:int" dfdl:lengthKind="explicit"
dfdl:length="1" />
- <xs:group name="unused_group">
+ <xs:group name="unused_group_1">
<xs:sequence>
<xs:element name="value1" type="xs:string" dfdl:lengthKind="explicit"
dfdl:length="1" />
<xs:sequence dfdl:terminator="{ ./value1 }" />
</xs:sequence>
</xs:group>
- <xs:complexType name="unused_complex_type">
+ <xs:complexType name="unused_complex_type_1">
<xs:sequence>
<xs:element name="value2" type="xs:string" dfdl:lengthKind="explicit"
dfdl:length="1" />
<xs:sequence dfdl:terminator="{ ./value2 }"/>
</xs:sequence>
</xs:complexType>
+
+ <xs:group name="unused_group_2">
+ <xs:sequence>
+ <xs:sequence dfdl:terminator="{ ./value3 }" />
+ </xs:sequence>
+ </xs:group>
+
+ <xs:complexType name="unused_complex_type_2">
+ <xs:sequence>
+ <xs:sequence dfdl:terminator="{ ./value4 }"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="unused_element_2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:sequence dfdl:terminator="{ ./value5 }"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+
+ <xs:group name="unused_group_3">
+ <xs:sequence>
+ <xs:element name="unused" type="xs:string" dfdl:terminator="{ ../value6
}" />
+ </xs:sequence>
+ </xs:group>
+
+ <xs:complexType name="unused_complex_type_3">
+ <xs:sequence>
+ <xs:element name="unused" type="xs:string" dfdl:terminator="{ ../value7
}" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="unused_element_3">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="unused" type="xs:string" dfdl:terminator="{
../../value8 }" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+
+ <xs:element name="unused_element_4">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="value9" type="xs:string" />
+ <xs:element name="nest1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="nest2" type="xs:string" dfdl:terminator="{
../../value9 }" />
Review Comment:
Doing some more playing around with this, a related issue is we don't even
compile expression on global element decls that aren't used. For example, we
could have a global element with an invalid expression like this:
```xml
<xs:element name="unused" type="xs:string" dfdl:terminator="{
dfdl:neverCompiled() }" />
```
And no error is created. As above, I think if we created a fake root when
compiling this it might solve the problem, but I'm not sure it's worth added
complexity.
--
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]