stevedlawrence commented on a change in pull request #143: Support dfdl:length="prefixed" URL: https://github.com/apache/incubator-daffodil/pull/143#discussion_r239894460
########## File path: daffodil-test/src/test/resources/org/apache/daffodil/section12/lengthKind/PrefixedTests.tdml ########## @@ -0,0 +1,1820 @@ +<?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 suiteName="PrefixedTests" + description="Section 12 - lengthKind=prefixed" xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:fn="http://www.w3.org/2005/xpath-functions" + xmlns:ex="http://example.com" + xmlns:tns="http://example.com" + xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext" + defaultRoundTrip="onePass"> + + <tdml:defineSchema name="lengthKindPrefixed-text.dfdl.xsd"> + + <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> + + <dfdl:format ref="ex:GeneralFormat" + representation="text" + encoding="UTF-8" + binaryDecimalVirtualPoint="2" + nilKind="literalValue" + nilValue="%WSP+;" + textBooleanTrueRep="TRUE" + textBooleanFalseRep="FALSE" + prefixIncludesPrefixLength="no" /> + + <xs:simpleType name="threeByteTextInt" dfdl:representation="text" dfdl:lengthKind="explicit" dfdl:length="3" dfdl:lengthUnits="bytes"> + <xs:restriction base="xs:integer" /> + </xs:simpleType> + + <xs:simpleType name="threeByteBinInt" dfdl:representation="binary" dfdl:lengthKind="explicit" dfdl:length="3" dfdl:lengthUnits="bytes"> + <xs:restriction base="xs:integer" /> + </xs:simpleType> + + <xs:simpleType name="twentyFourBitsTextInt" dfdl:representation="text" dfdl:lengthKind="explicit" dfdl:length="24" dfdl:lengthUnits="bits"> + <xs:restriction base="xs:integer" /> + </xs:simpleType> + + <xs:simpleType name="twentyFourBitsBinInt" dfdl:representation="binary" dfdl:lengthKind="explicit" dfdl:length="24" dfdl:lengthUnits="bits"> + <xs:restriction base="xs:integer" /> + </xs:simpleType> + + <xs:simpleType name="threeCharTextInt" dfdl:representation="text" dfdl:lengthKind="explicit" dfdl:length="3" dfdl:lengthUnits="characters" dfdl:textNumberJustification="left" dfdl:textPadKind="padChar" dfdl:textTrimKind="padChar" dfdl:textNumberPadCharacter="X"> + <xs:restriction base="xs:integer" /> + </xs:simpleType> + Review comment: Mentioned above, but aside for nested prefixs lengths (which isn't supported in this change), prefix types need to be implicit or explicit length and cannot be an expression, so the length must always be fixed. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
