mbeckerle commented on code in PR #1104:
URL: https://github.com/apache/daffodil/pull/1104#discussion_r1376463285


##########
daffodil-test/src/test/resources/org/apache/daffodil/extensions/repType/repType_01_b.dfdl.xsd:
##########
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<schema
+  xmlns="http://www.w3.org/2001/XMLSchema";
+  xmlns:xs="http://www.w3.org/2001/XMLSchema";
+  xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";
+  xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions";
+  xmlns:b="http://example.com";
+  targetNamespace="http://example.com";
+  elementFormDefault="unqualified">
+
+  <include 
schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd" />
+
+  <annotation>
+    <appinfo source="http://www.ogf.org/dfdl/";>
+      <dfdl:format ref="b:GeneralFormat" representation="binary" />
+    </appinfo>
+  </annotation>
+
+  <simpleType name="repType" dfdl:lengthKind="explicit" dfdl:length="1">
+    <restriction base="xs:int" />
+  </simpleType>
+
+  <simpleType name="valueType" dfdlx:repType="b:repType">

Review Comment:
   Ok, so the bug is that the quasi element gets the wrong XML scope.
   
   One way to illustrate that is for it to blow-up because in that (incorrect) 
scope it can't even resolve a namespace prefix. That's what you've illustrated 
here.
   
   Another version of the bug is because of that incorrect scope it resolves 
the QName without error, but to the wrong definition. I think you can't achieve 
that with only one namespace and an xs:include. You'd need two separate 
namespaces and an xs:import so that the reference could use the same qname 
"b:repType" but have that mean two entirely different definitions depending on 
which scope the quasi-element gets. 
   
   So file 'a' has target namespace 'a' with prefix 'a' but also has prefix 'b' 
defined to mean the same as the target namespace.
   
   File 'b' has target namespace 'b' with prefix 'b'.
   
   Define simpleType 'repType' in both files.
   
   In file 'a' add  dfdl:byteOrder="bigEndian" on the repType.
   
   In file 'a' add  in file add  dfdl:byteOrder="littleEndian" on the value 
element. 
   
   With incorrect scoping, file 'a' repType will be used because the qname 
b:repType will resolve to the definition for prefix b in file 'a' and it will 
pick the file 'a' repType, and that will have a conflicting dfdl:property 
definition. 
   
   With correct scoping nothing will go wrong. 
   
   Having now written all that down, I think it's not worth it. It's not 
illusrating anything new that your original tests don't verify by failing to 
find the definition for prefix b. 



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