tuxji commented on a change in pull request #395:
URL: https://github.com/apache/incubator-daffodil/pull/395#discussion_r452849693



##########
File path: 
daffodil-test/src/test/resources/org/apache/daffodil/section05/facets/NulChars.tdml
##########
@@ -0,0 +1,95 @@
+<?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.
+-->
+<tdml:testSuite
+  xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";
+  xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions";
+  xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData";
+  xmlns:ex="http://example.com";
+  xmlns:xs="http://www.w3.org/2001/XMLSchema";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  defaultRoundTrip="onePass"
+  defaultValidation="on">
+
+  <tdml:defineSchema name="nullTest">
+    <xs:include 
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+
+    <dfdl:format ref="ex:GeneralFormat"/>
+
+    <xs:element name="root">
+      <xs:complexType>
+        <xs:sequence>
+          <xs:element name="foo" dfdl:lengthKind="pattern" 
dfdl:lengthPattern="\x{0000}{3,3}">
+            <xs:simpleType>
+              <xs:restriction base="xs:string">
+                <xs:pattern value="&#xE000;*"/>

Review comment:
       I read 
[DAFFODIL-2363](https://issues.apache.org/jira/browse/DAFFODIL-2363) for more 
context.  If the goal is to capture NUL padding regions and check they are all 
NUL characters, then Steve's suggestion to change the pattern sounds like it 
might work.  Would that be good enough (just change the pattern) or do we need 
to check what the [DFDL specification](http://daffodil.apache.org/docs/dfdl/) 
says about how the validation should be performed in this edge case?  This 
section may apply:
   
   > 5.2.4       Pattern
   > ·         Allowed only on elements of type xs:string or types derived from 
it in Figure 3 DFDL simple types.
   > ·         Used for validation only
   > It is important to avoid confusion of the pattern facet with other uses of 
regular expressions that are needed in DFDL (for example, to determine the 
length of an element by regular expression matching).
   >Note: in XSD, pattern is about the lexical representation of the data, and 
since all is text there, everything has a lexical representation. In DFDL only 
strings are guaranteed to have a lexical and logical value that is identical.
   
   Also, should the pattern represent a NUL (character 0) codepoint using a 
DFDL character entity?
   
   > This NUL character code is not allowed in XML documents, including DFDL 
Schemas; hence, it must be specified using a DFDL Character Entity. Within a 
DFDL Expression, use the dfdl:decodeDFDLEntities() function to obtain a string 
containing this character.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to