Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: replaceDFDLEntities - 2nd place fixed

...

Code Block
languagehtml/xml
    <tdml:document>

        <!--
          A document part with type="text" is text. Use CDATA to avoid whitespace changes.

          So in the example below, the line ending after '250;' and after '967;' are intentional
          parts of the data so as to illustrate that the whitespace is preserved if immportant when
          you use CDATA bracketing.

          If you care exactly which kind of line ending is used, then you 
          can use DFDL character entities to insert a %CR; %LF; or both. In this example,
          because the whitespace is expressed as whitespace, it depends on the platform where
          you edit this file whether the line ending is a LF (Unix convention), or a 
          CRLF (MS Windows convention) 

          If you want to use DFDL character entities, you must turn on the 
          replaceDFDLEntities="true" feature of the documentPart element. 
        -->

      <tdml:documentPart type="text"><![CDATA[quantity:250;
hardnessRating:967;
]]></tdml:documentPart>

      <!-- 
          In 'text' both XML character entities, and DFDL's own character entities are interpreted.

          So here is a NUL terminated string that contains a date with some Japanese Kanji characters.
          The Japanese characters are expressed using XML numeric character entities. The NUL termination
          is expressed using a DFDL character entity.

          In this example one has no choice but to use a DFDL character entity. The NUL character (which has character
          code zero), is not allowed in XML documents, not even using an XML character entity. So you 
          have to write '%NUL;' or '%#x00;' to express it using DFDL character entities.
        -->

      <tdml:documentPart type="text" 
          replaceDFDLEntities="true"><![CDATA[1987&#x5E74;10&#x6708;&#x65e5; BCE%NUL;]]></tdml:documentPart>

      <!--
          Type 'byte' means use hexadecimal to specify the data. Freeform whitespace is allowed. 
          Actually, any character that is not a-zA-Z0-9 is ignored. So you can use "." or "-" to separate
          groups of hex digits if you like.
       -->
 
      <tdml:documentPart type="byte">
            9Abf e4c3
            A5-E9-FF-00
      </tdml:documentPart>
      
       <!--
          Type 'bits' allows you to specify individual 0 and 1. Any character other than 0 or 1 is ignored.
           
          The number of bits does not have to be a multiple of 8. That is, whole bytes are not required.
         -->

       <tdml:documentPart type="bits">
            1.110 0.011 1 First 5 bit fields.
       </tdml:documentPart>

       <!--
          Type 'file' means the content is a file name where to get the data
         -->
  
       <tdml:documentPart type="file">/some/directory/testData.in.dat</tdml:documentPart>

    </tdml:document>

...