Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-540

maxLength wanted when type is xs:int

XMLWordPrintableJSON

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • s11
    • s7
    • Front End
    • None

      I have this very basic element definition:

      <xs:element name="elem01" dfdl:lengthKind="implicit" dfdl:length="5" type="xs:int"/>

      When I specify this as the root of my test, I get the following error:

      [info] - test_implicit_with_len *** FAILED ***
      [info] java.lang.Exception: Schema Definition Error: MaxLength was asked
      for when isSimpleType(true) and isPrimitiveType(true) Schema context:
      element.elem01. Location line 69 column 89 in
      file:/home/jchab/NGF/dfdl/daffodil-test/target/scala-2.9.2/test-classes/edu
      /illinois/ncsa/daffodil/section12/lengthKind/implicit.tdml
      [info] at
      edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runParseExpectSuccess(TDMLRu
      nner.scala:473)
      [info] at
      edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runProcessor(TDMLRunner.scal
      a:372)
      [info] at
      edu.illinois.ncsa.daffodil.tdml.TestCase.run(TDMLRunner.scala:326)
      [info] at
      edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTest(TDMLRunner.scala:1
      98)
      [info] at
      edu.illinois.ncsa.daffodil.section12.lengthKind.TestLengthKindImplicit.test
      _implicit_with_len(TestLengthKindImplicit.scala:55)
      [info] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [info] at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:5
      7)
      [info] at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
      l.java:43)
      [info] at java.lang.reflect.Method.invoke(Method.java:601)
      [info] at
      org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod
      .java:47)
      [info] ...
      [info] - test_nested_seq_01

      however, maxLength can only be specified for xs:string and xs:hexBinary, and when I provide values for min and maxLength, I get errors that express such:

      [info] - test_implicit_with_len *** FAILED ***
      [info] java.lang.Exception: Schema Definition Error: MaxLength facet can
      only be applied to string or hexBinary.() Schema context: element.elem01.
      Location line 69 column 74 in
      file:/home/jchab/NGF/dfdl/daffodil-test/target/scala-2.9.2/test-classes/edu
      /illinois/ncsa/daffodil/section12/lengthKind/implicit.tdml
      [info] at
      edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runParseExpectSuccess(TDMLRu
      nner.scala:473)
      [info] at
      edu.illinois.ncsa.daffodil.tdml.ParserTestCase.runProcessor(TDMLRunner.scal
      a:372)
      [info] at
      edu.illinois.ncsa.daffodil.tdml.TestCase.run(TDMLRunner.scala:326)
      [info] at
      edu.illinois.ncsa.daffodil.tdml.DFDLTestSuite.runOneTest(TDMLRunner.scala:1
      98)
      [info] at
      edu.illinois.ncsa.daffodil.section12.lengthKind.TestLengthKindImplicit.test
      _implicit_with_len(TestLengthKindImplicit.scala:55)
      [info] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [info] at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:5
      7)
      [info] at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
      l.java:43)
      [info] at java.lang.reflect.Method.invoke(Method.java:601)
      [info] at
      org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod
      .java:47)

      The test is implicit_with_len and it can be found in the following files:

      M daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section12/lengthKind/implicit.tdml
      A daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section12/lengthKind/TestLengthKindImplicitDebug.scala
      M daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section12/lengthKind/TestLengthKindImplicit.scala

              jchab Jessie Chab
              jchab Jessie Chab
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: