I reverted this, by way of
git checkout asf-site git reset HEAD^ git stash git stash drop (ok... I could have done git reset --hard HEAD^ to do the same thing I guess.) git push --force origin asf-site Alas, when I look at the page: https://daffodil.apache.org/dfdl-layout/ I still see lots of markdown backticks and such that are supposed to cause content to present as code. Not sure what's up here. ________________________________ From: Mike Beckerle Sent: Tuesday, March 27, 2018 11:42:24 AM To: [email protected] Subject: Re: [incubator-daffodil-site] branch asf-site updated: Publishing from d4f1919ed5ae2011eec37087fe9a974dfbf35bc6 I installed jekyll using the default sudo apt-get install jekyll. jekyll --help says version 3.0.1 So looks like jekyll may be the issue. I'll see if I can update it and retry. Otherwise I'll revert this. The changes in content I pushed also to master branch, so those tiny changes are captured. ________________________________ From: Steve Lawrence <[email protected]> Sent: Tuesday, March 27, 2018 11:20:35 AM To: [email protected] Subject: Re: [incubator-daffodil-site] branch asf-site updated: Publishing from d4f1919ed5ae2011eec37087fe9a974dfbf35bc6 It looks like this commit messed up some pages and should probably be reverted. For example, the built.sbt section in the DFDL Layout page [1] no longer shows up as code, as if the markdown was just ignored. Looks like jekyll didn't convert things correctly? When I build from master and serve locally it looks right, so maybe this is a jekyll version issue? I'm using 3.2.1. - Steve [1] https://daffodil.apache.org/dfdl-layout/#buildsbt On 03/27/2018 11:10 AM, [email protected] wrote: > This is an automated email from the ASF dual-hosted git repository. > > mbeckerle pushed a commit to branch asf-site > in repository https://gitbox.apache.org/repos/asf/incubator-daffodil-site.git > > > The following commit(s) were added to refs/heads/asf-site by this push: > new ac91d65 Publishing from d4f1919ed5ae2011eec37087fe9a974dfbf35bc6 > ac91d65 is described below > > commit ac91d65f9dacd6713e396b3c81347b47eb2b4e03 > Author: Michael Beckerle <[email protected]> > AuthorDate: Tue Mar 27 11:09:57 2018 -0400 > > Publishing from d4f1919ed5ae2011eec37087fe9a974dfbf35bc6 > --- > content/community/index.html | 6 +- > content/configuration/index.html | 42 ++--- > content/dfdl-extensions/index.html | 47 +++--- > content/dfdl-layout/index.html | 68 ++++---- > content/examples/index.html | 196 +++++++++++----------- > content/faq/index.html | 146 +++++++++-------- > content/infoset/index.html | 6 +- > content/people/index.html | 2 +- > content/tdml/index.html | 326 > +++++++++++++++++-------------------- > 9 files changed, 403 insertions(+), 436 deletions(-) > > diff --git a/content/community/index.html b/content/community/index.html > index cda0615..a4602dc 100644 > --- a/content/community/index.html > +++ b/content/community/index.html > @@ -109,15 +109,15 @@ > <p>Get help using Daffodil or contribute to the project on our mailing > lists:</p> > > <dl> > - <dt><a > href="mailto:[email protected]">[email protected]</a> – <a > href="mailto:[email protected]?subject=send this email to > subscribe">subscribe</a>, <a > href="mailto:[email protected]?subject=send this email to > unsubscribe">unsubscribe</a>, <a > href="https://lists.apache.org/[email protected]">archives</a></dt> > + <dt><a > href="mailto:users@daffodil.apache.org">users@daffodil.apache.org</a> > – <a > href="mailto:users-subscrib& > [...] > <dd> > <p>For usage/help questions (e.g. DFDL schema creation, CLI/API usage) > and announcements</p> > </dd> > - <dt><a href="mailto:[email protected]">[email protected]</a> – > <a href="mailto:[email protected]?subject=send this email to > subscribe">subscribe</a>, <a > href="mailto:[email protected]?subject=send this email to > unsubscribe">unsubscribe</a>, <a > href="https://lists.apache.org/[email protected]">archives</a></dt> > + <dt><a > href="mailto:dev@daffodil.apache.org">dev@daffodil.apache.org</a> > – <a > href="mailto:dev-subscribe@daff& > [...] > <dd> > <p>For those who want to contribute code to Daffodil, join in on design > discussions, track issues and Daffodil development, etc.</p> > </dd> > - <dt><a > href="mailto:[email protected]">[email protected]</a> – <a > href="mailto:[email protected]?subject=send this email to > subscribe">subscribe</a>, <a > href="mailto:[email protected]?subject=send this email > to unsubscribe">unsubscribe</a>, <a > href="https://lists.apache.org/[email protected]">archives</a></dt> > + <dt><a > href="mailto:comits@daffodil.apache.org">[email protected]</a> > – <a > href="mailto:commits-subscribe@daffodil.apache > [...] > <dd> > <p>For tracking new commits to the Daffodil codebase</p> > </dd> > diff --git a/content/configuration/index.html > b/content/configuration/index.html > index b528890..4f08861 100644 > --- a/content/configuration/index.html > +++ b/content/configuration/index.html > @@ -99,35 +99,35 @@ > > <p>External variables can be defined using the <code > class="highlighter-rouge">externalVariablesBindings</code> tag. For example, > the following configuration file defines two variables, <code > class="highlighter-rouge">var1</code> and <code > class="highlighter-rouge">var2</code>, in the <code > class="highlighter-rouge">http://example.com</code> namespace.</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="cp"><?xml version="1.0" > encoding="UTF-8"?></span> > -<span class="nt"><dfdlConfig</span> <span class="na">xmlns=</span><span > class="s">"http://www.w3.org/2001/XMLSchema"</span> <span > class="na">xmlns:ex=</span><span class="s">"http://example.com"</span><span > class="nt">></span> > - <span class="nt"><externalVariableBindings></span> > - <span class="nt"><bind</span> <span class="na">name=</span><span > class="s">"ex:var1"</span><span class="nt">></span>-9<span > class="nt"></bind></span> > - <span class="nt"><bind</span> <span class="na">name=</span><span > class="s">"ex:var2"</span><span class="nt">></span>Foo<span > class="nt"></bind></span> > - <span class="nt"></externalVariableBindings></span> > -<span class="nt"></dfdlConfig></span> > -</code></pre> > -</div> > +<p>``` xml > +<?xml version="1.0" encoding="UTF-8"?></p> > +<dfdlconfig xmlns="http://www.w3.org/2001/XMLSchema" > xmlns:ex="http://example.com"> > + <externalvariablebindings> > + <bind name="ex:var1">-9</bind> > + <bind name="ex:var2">Foo</bind> > + </externalvariablebindings> > +</dfdlconfig> > +<p>```</p> > > <p>The following defined in a DFDL schema would allow the external variables > to be set or overridden:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><dfdl:defineVariable</span> <span > class="na">name=</span><span class="s">"var1"</span> <span > class="na">external=</span><span class="s">"true"</span> <span > class="na">type=</span><span class="s">"xsd:int"</span><span > class="nt">></span>1<span class="nt"></dfdl:defineVariable></span> > -<span class="nt"><dfdl:defineVariable</span> <span > class="na">name=</span><span class="s">"var2"</span> <span > class="na">external=</span><span class="s">"true"</span> <span > class="na">type=</span><span class="s">"xsd:string"</span><span > class="nt">></span>Bar<span class="nt"></dfdl:defineVariable></span> > -</code></pre> > -</div> > +<p>``` xml</p> > +<dfdl:definevariable name="var1" external="true" > type="xsd:int">1</dfdl:definevariable> > +<dfdl:definevariable name="var2" external="true" > type="xsd:string">Bar</dfdl:definevariable> > +<p>```</p> > > <h3 id="tunable-parameters">Tunable Parameters</h3> > > <p>Tunable parameters can be modified to change Daffodil schema compilation > and data parsing properties. For example, the following sets the <code > class="highlighter-rouge">maxOccursBounds</code> tunable to 1024:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="cp"><?xml version="1.0" > encoding="UTF-8"?></span> > -<span class="nt"><dfdlConfig</span> <span class="na">xmlns=</span><span > class="s">"http://www.w3.org/2001/XMLSchema"</span> <span > class="na">xmlns:ex=</span><span class="s">"http://example.com"</span><span > class="nt">></span> > - <span class="nt"><tunables></span> > - <span class="nt"><maxOccursBounds></span>1024<span > class="nt"></maxOccursBounds></span> > - <span class="nt"></tunables></span> > -<span class="nt"></dfdlConfig></span> > -</code></pre> > -</div> > +<p>``` xml > +<?xml version="1.0" encoding="UTF-8"?></p> > +<dfdlconfig xmlns="http://www.w3.org/2001/XMLSchema" > xmlns:ex="http://example.com"> > + <tunables> > + <maxoccursbounds>1024</maxoccursbounds> > + </tunables> > +</dfdlconfig> > +<p>```</p> > > <p>Below is a description of the available tunable parameters:</p> > > diff --git a/content/dfdl-extensions/index.html > b/content/dfdl-extensions/index.html > index 933971c..55fce11 100644 > --- a/content/dfdl-extensions/index.html > +++ b/content/dfdl-extensions/index.html > @@ -95,41 +95,34 @@ > > <p>Daffodil provides extensions to the DFDL specification. These properties > are in the namespace defined by the URI <code > class="highlighter-rouge">urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext</code>. > To use these the Daffodil DFDL Extensions, bind this namespace to the <code > class="highlighter-rouge">daf</code> prefix in the <code > class="highlighter-rouge">xs:schema</code> element, like so:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><xs:schema</span> <span > class="na">xmlns:xs=</span><span > class="s">"http://www.w3.org/2001/XMLSchema"</span> > - <span class="na">xmlns:dfdl=</span><span > class="s">"http://www.ogf.org/dfdl/dfdl-1.0/"</span> > - <span class="na">xmlns:daf=</span><span > class="s">"urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"</span><span > class="nt">></span> > -</code></pre> > -</div> > +<p>``` xml</p> > +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" > xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"> > +``` > + > +The following symbols defined in this namespace are described below. > + > +### Expression Functions > + > +``daf:error()`` > + > + : A function that can be used in DFDL expressions. This functions does > not return a value or accept any arguments. When called, it causes a Parse > Error or Unparse Error. > > -<p>The following symbols defined in this namespace are described below.</p> > + *This function is deprecated as of Daffodil 2.0.0. Use the > ``fn:error(...)`` function instead.* > > -<h3 id="expression-functions">Expression Functions</h3> > +``daf:trace($value, $label)`` > > -<dl> > - <dt><code class="highlighter-rouge">daf:error()</code></dt> > - <dd> > - <p>A function that can be used in DFDL expressions. This functions does > not return a value or accept any arguments. When called, it causes a Parse > Error or Unparse Error.</p> > + : A function that can be used in DFDL expressions, similar to the > ``fn:trace()`` function. This logs the string ``$label`` followed by > ``$value`` converted to a string and returns ``$value``. The second argument > must be of type ``xs:string``. > > - <p><em>This function is deprecated as of Daffodil 2.0.0. Use the <code > class="highlighter-rouge">fn:error(...)</code> function instead.</em></p> > - </dd> > - <dt><code class="highlighter-rouge">daf:trace($value, $label)</code></dt> > - <dd> > - <p>A function that can be used in DFDL expressions, similar to the <code > class="highlighter-rouge">fn:trace()</code> function. This logs the string > <code class="highlighter-rouge">$label</code> followed by <code > class="highlighter-rouge">$value</code> converted to a string and returns > <code class="highlighter-rouge">$value</code>. The second argument must be of > type <code class="highlighter-rouge">xs:string</code>.</p> > - </dd> > -</dl> > +### Properties > > -<h3 id="properties">Properties</h3> > +``daf:parseUnparsePolicy`` > > -<dl> > - <dt><code class="highlighter-rouge">daf:parseUnparsePolicy</code></dt> > - <dd> > - <p>A property applied to simple and complex elements, which specifies > whether the element supports only parsing, only unparsing, or both parsing > and unparse. Valid values for this property are <code > class="highlighter-rouge">parse</code>, <code > class="highlighter-rouge">unparse</code>, or <code > class="highlighter-rouge">both</code>. This allows one to leave off > properties that are required for only parse or only unparse, such as <code > class="highlighter-rouge">dfdl:outputValueCalc</c [...] > + : A property applied to simple and complex elements, which specifies > whether the element supports only parsing, only unparsing, or both parsing > and unparse. Valid values for this property are ``parse``, ``unparse``, or > ``both``. This allows one to leave off properties that are required for only > parse or only unparse, such as ``dfdl:outputValueCalc`` or > ``dfdl:outputNewLine``, so that one may have a valid schema if only a subset > of functionality is needed. > > - <p>All elements must have a compatible parseUnparsePolicy with the > compilation parseUnparsePolicy (which is defined by the root element > daf:parseUnparsePolicy and/or the Daffodil parseUnparsePolicy tunable) or it > is a Schema Definition Error. An element is defined to have a compatible > parseUnparsePolicy if it has the same value as the compilation > parseUnparsePolicy or if it has the value <code > class="highlighter-rouge">both</code>.</p> > + All elements must have a compatible parseUnparsePolicy with the > compilation parseUnparsePolicy (which is defined by the root element > daf:parseUnparsePolicy and/or the Daffodil parseUnparsePolicy tunable) or it > is a Schema Definition Error. An element is defined to have a compatible > parseUnparsePolicy if it has the same value as the compilation > parseUnparsePolicy or if it has the value ``both``. > > - <p>For compatibility, if this property is not defined, it is assumed to > be <code class="highlighter-rouge">both</code>.</p> > - </dd> > -</dl> > + For compatibility, if this property is not defined, it is assumed to be > ``both``. > +</xs:schema> > > </div> > </div> > diff --git a/content/dfdl-layout/index.html b/content/dfdl-layout/index.html > index ad212ae..4c8e6b5 100644 > --- a/content/dfdl-layout/index.html > +++ b/content/dfdl-layout/index.html > @@ -160,30 +160,30 @@ > > <p>Use the below template for the build.sbt file:</p> > > -<div class="language-scala highlighter-rouge"><pre > class="highlight"><code><span class="n">name</span> <span class="o">:=</span> > <span class="s">"dfdl-RFormat"</span> > - > -<span class="n">organization</span> <span class="o">:=</span> <span > class="s">"org.apache"</span> > - > -<span class="n">version</span> <span class="o">:=</span> <span > class="s">"0.0.1"</span> > - > -<span class="n">scalaVersion</span> <span class="o">:=</span> <span > class="s">"2.11.8"</span> > - > -<span class="n">crossPaths</span> <span class="o">:=</span> <span > class="kc">false</span> > - > -<span class="n">testOptions</span> <span class="n">in</span> <span > class="nc">ThisBuild</span> <span class="o">+=</span> <span > class="nc">Tests</span><span class="o">.</span><span > class="nc">Argument</span><span class="o">(</span><span > class="nc">TestFrameworks</span><span class="o">.</span><span > class="nc">JUnit</span><span class="o">,</span> <span > class="s">"-v"</span><span class="o">)</span> > - > -<span class="n">resolvers</span> <span class="n">in</span> <span > class="nc">ThisBuild</span> <span class="o">++=</span> <span > class="nc">Seq</span><span class="o">(</span> > - <span class="s">"NCSA Sonatype Releases"</span> <span class="n">at</span> > <span > class="s">"https://opensource.ncsa.illinois.edu/nexus/content/repositories/releases"</span><span > class="o">,</span> > - <span class="s">"NCSA Sonatype Snapshots"</span> <span class="n">at</span> > <span > class="s">"https://opensource.ncsa.illinois.edu/nexus/content/repositories/snapshots"</span> > -<span class="o">)</span> > - > -<span class="n">libraryDependencies</span> <span class="n">in</span> <span > class="nc">ThisBuild</span> <span class="o">:=</span> <span > class="nc">Seq</span><span class="o">(</span> > - <span class="s">"edu.illinois.ncsa"</span> <span class="o">%%</span> <span > class="s">"daffodil-tdml"</span> <span class="o">%</span> <span > class="s">"2.0.0"</span> <span class="o">%</span> <span > class="s">"test"</span> > - <span class="s">"junit"</span> <span class="o">%</span> <span > class="s">"junit"</span> <span class="o">%</span> <span > class="s">"4.11"</span> <span class="o">%</span> <span > class="s">"test"</span><span class="o">,</span> > - <span class="s">"com.novocode"</span> <span class="o">%</span> <span > class="s">"junit-interface"</span> <span class="o">%</span> <span > class="s">"0.10"</span> <span class="o">%</span> <span > class="s">"test"</span><span class="o">,</span> > -<span class="o">)</span> > -</code></pre> > -</div> > +<p>``` scala > +name := “dfdl-RFormat”</p> > + > +<p>organization := “org.apache”</p> > + > +<p>version := “0.0.1”</p> > + > +<p>scalaVersion := “2.11.8”</p> > + > +<p>crossPaths := false</p> > + > +<p>testOptions in ThisBuild += Tests.Argument(TestFrameworks.JUnit, “-v”)</p> > + > +<p>resolvers in ThisBuild ++= Seq( > + “NCSA Sonatype Releases” at > “https://opensource.ncsa.illinois.edu/nexus/content/repositories/releases”, > + “NCSA Sonatype Snapshots” at > “https://opensource.ncsa.illinois.edu/nexus/content/repositories/snapshots” > +)</p> > + > +<p>libraryDependencies in ThisBuild := Seq( > + “edu.illinois.ncsa” %% “daffodil-tdml” % “2.0.0” % “test” > + “junit” % “junit” % “4.11” % “test”, > + “com.novocode” % “junit-interface” % “0.10” % “test”, > +) > +```</p> > > <p>Edit the version of daffodil-tdml above to match the version you are > using.</p> > > @@ -203,17 +203,19 @@ > > <p>The <code class="highlighter-rouge">xs:include</code> or <code > class="highlighter-rouge">xs:import</code> elements of a DFDL Schema can > import/include a DFDL schema that follows these conventions like this:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><xs:import</span> <span > class="na">namespace=</span><span class="s">"urn:tresys.com/RFormat"</span> > <span class="na">schemaLocation=</span><span > class="s">"com/tresys/RFormat/xsd/main.dfdl.xsd"</span><span > class="nt">/></span> > -</code></pre> > -</div> > +<p>``` xml</p> > +<xs:import namespace="urn:tresys.com/RFormat" > schemalocation="com/tresys/RFormat/xsd/main.dfdl.xsd" /> > + > +<p>```</p> > > <p>The above is for using a DFDL schema as a library, from another different > DFDL schema.</p> > > <p>Within a DFDL schema, one DFDL schema file can reference another peer > file that appears in the same directory (the src/main/resources/…/xsd > directory) via:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><xs:include</span> <span > class="na">schemaLocation=</span><span > class="s">"format.dfdl.xsd"</span><span class="nt">/></span> > -</code></pre> > -</div> > +<p>``` xml</p> > +<xs:include schemalocation="format.dfdl.xsd" /> > + > +<p>```</p> > > <p>That is, peer files need not carry the long <code > class="highlighter-rouge">com/tresys/RFormat/xsd/</code> prefix that makes > the reference globally unique.</p> > > @@ -240,9 +242,9 @@ sbt publishLocal # puts it into local .ivy2 cache where > other maven/sbt will fin > > <p>That enables a different schema’s <code > class="highlighter-rouge">build.sbt</code> to contain a library dependency on > our hypthetical dfdl-RFormat schema using a dependency like this:</p> > > -<div class="highlighter-rouge"><pre class="highlight"><code>"org.apache" % > "dfdl-RFormat" % "0.0.1" % "test" > -</code></pre> > -</div> > +<p><code class="highlighter-rouge"> > +"org.apache" % "dfdl-RFormat" % "0.0.1" % "test" > +</code></p> > > <p>That will result in the contents of the <code > class="highlighter-rouge">src/main/resources</code> directory above being on > the classpath. XSD include and import statements search the classpath > directories.</p> > > diff --git a/content/examples/index.html b/content/examples/index.html > index c1ac343..d24e740 100644 > --- a/content/examples/index.html > +++ b/content/examples/index.html > @@ -99,48 +99,48 @@ > > <p>This DFDL schema is found at the DFDLSchemas GitHub <a > href="https://github.com/DFDLSchemas/CSV">CSV repository</a>.</p> > > -<div class="language-bash highlighter-rouge"><pre > class="highlight"><code><span class="gp">$ </span>daffodil parse --schema > CSV/src/main/resources/com/tresys/csv/xsd/csv.dfdl.xsd > CSV/src/test/resources/com/tresys/csv/data/simpleCSV.csv > -</code></pre> > -</div> > -<p>The above command uses the csv.dfdl.xsd schema to parse the simpleCSV.csv > input data. The simpleCSV.csv contains the following data:</p> > +<p><code class="highlighter-rouge">bash > +$ daffodil parse --schema > CSV/src/main/resources/com/tresys/csv/xsd/csv.dfdl.xsd > CSV/src/test/resources/com/tresys/csv/data/simpleCSV.csv > +</code> > +The above command uses the csv.dfdl.xsd schema to parse the simpleCSV.csv > input data. The simpleCSV.csv contains the following data:</p> > > -<div class="highlighter-rouge"><pre > class="highlight"><code>last,first,middle,DOB > +<p><code class="highlighter-rouge"> > +last,first,middle,DOB > smith,robert,brandon,1988-03-24 > johnson,john,henry,1986-01-23 > jones,arya,cat,1986-02-19 > -</code></pre> > -</div> > +</code></p> > > <p>The result of the parse is the following XML:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><ex:file</span> <span > class="na">xmlns:ex=</span><span class="s">"http://example.com"</span><span > class="nt">></span> > - <span class="nt"><header></span> > - <span class="nt"><title></span>last<span > class="nt"></title></span> > - <span class="nt"><title></span>first<span > class="nt"></title></span> > - <span class="nt"><title></span>middle<span > class="nt"></title></span> > - <span class="nt"><title></span>DOB<span > class="nt"></title></span> > - <span class="nt"></header></span> > - <span class="nt"><record></span> > - <span class="nt"><item></span>smith<span > class="nt"></item></span> > - <span class="nt"><item></span>robert<span > class="nt"></item></span> > - <span class="nt"><item></span>brandon<span > class="nt"></item></span> > - <span class="nt"><item></span>1988-03-24<span > class="nt"></item></span> > - <span class="nt"></record></span> > - <span class="nt"><record></span> > - <span class="nt"><item></span>johnson<span > class="nt"></item></span> > - <span class="nt"><item></span>john<span > class="nt"></item></span> > - <span class="nt"><item></span>henry<span > class="nt"></item></span> > - <span class="nt"><item></span>1986-01-23<span > class="nt"></item></span> > - <span class="nt"></record></span> > - <span class="nt"><record></span> > - <span class="nt"><item></span>jones<span > class="nt"></item></span> > - <span class="nt"><item></span>arya<span > class="nt"></item></span> > - <span class="nt"><item></span>cat<span > class="nt"></item></span> > - <span class="nt"><item></span>1986-02-19<span > class="nt"></item></span> > - <span class="nt"></record></span> > -<span class="nt"></ex:file></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<ex:file xmlns:ex="http://example.com"> > + <header> > + <title>last</title> > + <title>first</title> > + <title>middle</title> > + <title>DOB</title> > + </header> > + <record> > + <item>smith</item> > + <item>robert</item> > + <item>brandon</item> > + <item>1988-03-24</item> > + </record> > + <record> > + <item>johnson</item> > + <item>john</item> > + <item>henry</item> > + <item>1986-01-23</item> > + </record> > + <record> > + <item>jones</item> > + <item>arya</item> > + <item>cat</item> > + <item>1986-02-19</item> > + </record> > +</ex:file> > +<p>```</p> > > <h3 id="packet-capture-data-pcap">Packet Capture Data (PCAP)</h3> > > @@ -148,82 +148,82 @@ jones,arya,cat,1986-02-19 > > <p>The PCAP file format is a binary file format used to capture network > packets. For information on this file format, visit the <a > href="http://wiki.wireshark.org/Development/LibpcapFileFormat">Wireshark > Libpcap File Format</a> page.</p> > > -<div class="language-bash highlighter-rouge"><pre > class="highlight"><code><span class="gp">$ </span>daffodil parse --schema > PCAP/src/main/resources/com/tresys/pcap/xsd/pcap.dfdl.xsd > PCAP/src/test/resources/com/tresys/pcap/data/icmp.cap > -</code></pre> > -</div> > +<p><code class="highlighter-rouge">bash > +$ daffodil parse --schema > PCAP/src/main/resources/com/tresys/pcap/xsd/pcap.dfdl.xsd > PCAP/src/test/resources/com/tresys/pcap/data/icmp.cap > +</code></p> > > <p>The above command uses the pcap.dfdl.xsd schema to parse the icmp.cap > input file. Viewed as a hex dump, the icmp.cap file looks like:</p> > > -<div class="highlighter-rouge"><pre class="highlight"><code>0000000 c3d4 > a1b2 0002 0004 0000 0000 0000 0000 > +<p><code class="highlighter-rouge"> > +0000000 c3d4 a1b2 0002 0004 0000 0000 0000 0000 > 0000020 ffff 0000 0001 0000 6fc4 51c1 ccf8 000c > 0000040 004a 0000 004a 0000 5000 e056 4914 0c00 > ... > 0001300 0000 5c2f 0002 0024 6261 6463 6665 6867 > 0001320 6a69 6c6b 6e6d 706f 7271 7473 7675 6177 > 0001340 6362 6564 6766 6968 > -</code></pre> > -</div> > +</code></p> > > <p>The result of the parse is the following XML:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><pcap:PCAP</span> <span > class="na">xmlns:pcap=</span><span class="s">"urn:pcap:2.4"</span><span > class="nt">></span> > - <span class="nt"><PCAPHeader></span> > - <span class="nt"><MagicNumber></span>D4C3B2A1<span > class="nt"></MagicNumber></span> > - <span class="nt"><Version></span> > - <span class="nt"><Major></span>2<span > class="nt"></Major></span> > - <span class="nt"><Minor></span>4<span > class="nt"></Minor></span> > - <span class="nt"></Version></span> > - <span class="nt"><Zone></span>0<span > class="nt"></Zone></span> > - <span class="nt"><SigFigs></span>0<span > class="nt"></SigFigs></span> > - <span class="nt"><SnapLen></span>65535<span > class="nt"></SnapLen></span> > - <span class="nt"><Network></span>1<span > class="nt"></Network></span> > - <span class="nt"></PCAPHeader></span> > - <span class="nt"><Packet></span> > - <span class="nt"><PacketHeader></span> > - <span class="nt"><Seconds></span>1371631556<span > class="nt"></Seconds></span> > - <span class="nt"><USeconds></span>838904<span > class="nt"></USeconds></span> > - <span class="nt"><InclLen></span>74<span > class="nt"></InclLen></span> > - <span class="nt"><OrigLen></span>74<span > class="nt"></OrigLen></span> > - <span class="nt"></PacketHeader></span> > - <span class="nt"><pcap:LinkLayer></span> > - <span class="nt"><pcap:Ethernet></span> > - <span class="nt"><MACDest></span>005056E01449<span > class="nt"></MACDest></span> > - <span class="nt"><MACSrc></span>000C29340BDE<span > class="nt"></MACSrc></span> > - <span class="nt"><Ethertype></span>2048<span > class="nt"></Ethertype></span> > - <span class="nt"><pcap:NetworkLayer></span> > - <span class="nt"><pcap:IPv4></span> > - <span class="nt"><IPv4Header></span> > - <span class="nt"><Version></span>4<span > class="nt"></Version></span> > - <span class="nt"><IHL></span>5<span > class="nt"></IHL></span> > - <span class="nt"><DSCP></span>0<span > class="nt"></DSCP></span> > - <span class="nt"><ECN></span>0<span > class="nt"></ECN></span> > - <span class="nt"><Length></span>60<span > class="nt"></Length></span> > - <span class="nt"><Identification></span>55107<span > class="nt"></Identification></span> > - <span class="nt"><Flags></span>0<span > class="nt"></Flags></span> > - <span class="nt"><FragmentOffset></span>0<span > class="nt"></FragmentOffset></span> > - <span class="nt"><TTL></span>128<span > class="nt"></TTL></span> > - <span class="nt"><Protocol></span>1<span > class="nt"></Protocol></span> > - <span class="nt"><Checksum></span>11123<span > class="nt"></Checksum></span> > - <span class="nt"><IPSrc></span>192.168.158.139<span > class="nt"></IPSrc></span> > - <span class="nt"><IPDest></span>174.137.42.77<span > class="nt"></IPDest></span> > - <span class="nt"></IPv4Header></span> > - <span class="nt"><PayloadLength></span>40<span > class="nt"></PayloadLength></span> > - <span class="nt"><Protocol></span>1<span > class="nt"></Protocol></span> > - <span class="nt"><pcap:ICMPv4></span> > - <span class="nt"><Type></span>8<span > class="nt"></Type></span> > - <span class="nt"><Code></span>0<span > class="nt"></Code></span> > - <span class="nt"><Checksum></span>10844<span > class="nt"></Checksum></span> > - <span class="nt"><Data></span>02002100<span > class="nt"></Data></span> > - <span class="nt"></pcap:ICMPv4></span> > - <span class="nt"></pcap:IPv4></span> > - <span class="nt"></pcap:NetworkLayer></span> > - <span class="nt"></pcap:Ethernet></span> > - <span class="nt"></pcap:LinkLayer></span> > - <span class="nt"></Packet></span> > +<p>```xml</p> > +<pcap:pcap xmlns:pcap="urn:pcap:2.4"> > + <pcapheader> > + <magicnumber>D4C3B2A1</magicnumber> > + <version> > + <major>2</major> > + <minor>4</minor> > + </version> > + <zone>0</zone> > + <sigfigs>0</sigfigs> > + <snaplen>65535</snaplen> > + <network>1</network> > + </pcapheader> > + <packet> > + <packetheader> > + <seconds>1371631556</seconds> > + <useconds>838904</useconds> > + <incllen>74</incllen> > + <origlen>74</origlen> > + </packetheader> > + <pcap:linklayer> > + <pcap:ethernet> > + <macdest>005056E01449</macdest> > + <macsrc>000C29340BDE</macsrc> > + <ethertype>2048</ethertype> > + <pcap:networklayer> > + <pcap:ipv4> > + <ipv4header> > + <version>4</version> > + <ihl>5</ihl> > + <dscp>0</dscp> > + <ecn>0</ecn> > + <length>60</length> > + <identification>55107</identification> > + <flags>0</flags> > + <fragmentoffset>0</fragmentoffset> > + <ttl>128</ttl> > + <protocol>1</protocol> > + <checksum>11123</checksum> > + <ipsrc>192.168.158.139</ipsrc> > + <ipdest>174.137.42.77</ipdest> > + </ipv4header> > + <payloadlength>40</payloadlength> > + <protocol>1</protocol> > + <pcap:icmpv4> > + <type>8</type> > + <code>0</code> > + <checksum>10844</checksum> > + <data>02002100</data> > + </pcap:icmpv4> > + </pcap:ipv4> > + </pcap:networklayer> > + </pcap:ethernet> > + </pcap:linklayer> > + </packet> > ... > -<span class="nt"></pcap:PCAP></span> > -</code></pre> > -</div> > +</pcap:pcap> > +<p>```</p> > > </div> > </div> > diff --git a/content/faq/index.html b/content/faq/index.html > index c84da6e..d7140ae 100644 > --- a/content/faq/index.html > +++ b/content/faq/index.html > @@ -108,9 +108,10 @@ > <div id="faq1" class="collapse"> > <p>Here’s part of an example from the DFDL tutorial of a street > address:</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><xs:element</span> <span > class="na">name=</span><span class="s">"houseNumber"</span> <span > class="na">type=</span><span class="s">"xs:string"</span> <span > class="na">dfdl:lengthKind=</span><span class="s">"explicit"</span> <span > class="na">dfdl:length=</span><span class="s">"6"</span><span > class="nt">/></span> > -</code></pre> > - </div> > + <p>``` xml</p> > + <xs:element name="houseNumber" type="xs:string" dfdl:lengthkind="explicit" > dfdl:length="6" /> > + > + <p>```</p> > > <p>Note that the length of the house number is constrained with DFDL. XSD > can also be used to constrain lengths.</p> > > @@ -120,38 +121,39 @@ > > <p>Consider</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><xs:element</span> <span > class="na">name=</span><span class="s">"article"</span> <span > class="na">type=</span><span class="s">"xs:string"</span> <span > class="na">dfdl:length=</span><span class="s">"{ ../header/articleLength > }"</span> <span class="na">dfdl:lengthKind=</span><span > class="s">'explicit'</span><span class="nt">/></span> > -</code></pre> > - </div> > + <p>``` xml</p> > + <xs:element name="article" type="xs:string" dfdl:length="{ > ../header/articleLength }" dfdl:lengthkind="explicit" /> > + > + <p>```</p> > > <p>Now the length is coming from a field someplace at runtime. Validating > that it is within some additional constraints on maxLength might be very > valuable. To do that you nave to write the more verbose:</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><xs:element</span> <span > class="na">name=</span><span class="s">"article"</span> <span > class="na">dfdl:length=</span><span class="s">"{ ../header/articleLength > }"</span> <span class="na">dfdl:lengthKind=</span><span > class="s">'explicit'</span><span class="nt">></span> > - <span class="nt"><xs:simpleType></span> > - <span class="nt"><xs:restriction</span> <span > class="na">base=</span><span class="s">"xs:string"</span><span > class="nt">></span> > - <span class="nt"><xs:maxLength</span> <span > class="na">value=</span><span class="s">"140"</span><span > class="nt">/></span> > - <span class="nt"></xs:restriction></span> > - <span class="nt"></xs:simpleType></span> > -<span class="nt"></xs:element></span> > -</code></pre> > - </div> > + <p>``` xml</p> > + <xs:element name="article" dfdl:length="{ ../header/articleLength }" > dfdl:lengthkind="explicit"> > + <xs:simpletype> > + <xs:restriction base="xs:string"> > + <xs:maxlength value="140" /> > + </xs:restriction> > + </xs:simpletype> > +</xs:element> > + <p>```</p> > > <p>Not too bad actually. And if you can reuse some simple type definitions > it’s not bad at all.</p> > > <p>One further point. Suppose you want to parse the string using the > header-supplied length, but it’s flat out a parse error if the length turns > out to be greater than 140. You can ask the DFDL processor to check the facet > maxLength at parse time using an assertion like this:</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><xs:element</span> <span > class="na">name=</span><span class="s">"article"</span> <span > class="na">dfdl:length=</span><span class="s">"{ ../header/articleLength > }"</span> <span class="na">dfdl:lengthKind=</span><span > class="s">'explicit'</span><span class="nt">></span> > - <span class="nt"><xs:simpleType></span> > - <span class="nt"><xs:annotation><xs:appinfo</span> <span > class="na">source=</span><span > class="s">"http://www.ogf.org/dfdl/dfdl-1.0"</span><span > class="nt">></span> > - <span class="nt"><dfdl:assert></span>{ dfdl:checkConstraints() > }<span class="nt"></dfdl:assert></span> > - <span class="nt"></xs:appinfo></xs:annotation></span> > - <span class="nt"><xs:restriction</span> <span > class="na">base=</span><span class="s">"xs:string"</span><span > class="nt">></span> > - <span class="nt"><xs:maxLength</span> <span > class="na">value=</span><span class="s">"140"</span><span > class="nt">/></span> > - <span class="nt"></xs:restriction></span> > - <span class="nt"></xs:simpleType></span> > -<span class="nt"></xs:element></span> > -</code></pre> > - </div> > + <p>``` xml</p> > + <xs:element name="article" dfdl:length="{ ../header/articleLength }" > dfdl:lengthkind="explicit"> > + <xs:simpletype> > + <xs:annotation><xs:appinfo source="http://www.ogf.org/dfdl/dfdl-1.0"> > + <dfdl:assert>{ dfdl:checkConstraints() }</dfdl:assert> > + </xs:appinfo></xs:annotation> > + <xs:restriction base="xs:string"> > + <xs:maxlength value="140" /> > + </xs:restriction> > + </xs:simpletype> > +</xs:element> > + <p>```</p> > > <p>The dfdl:assert statement annotation calls a built-in DFDL function > called dfdl:checkConstraints, which tells DFDL to test the facet constraints > and issue a parse error if they are not satisfied. This is particularly > useful for enumeration constraints where an element value is an identifier of > some sort.</p> > </div> > @@ -166,9 +168,9 @@ > > <p>By way of illustrating what not to do, it is tempting to put facet > constraints on simple type definitions in your schema, and then use a > dfdl:assert like this:</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><dfdl:assert></span>{ > checkConstraints(.) }<span class="nt"></dfdl:assert></span> > -</code></pre> > - </div> > + <p>```xml</p> > + <dfdl:assert>{ checkConstraints(.) }</dfdl:assert> > + <p>```</p> > > <p>so that the parser will validate as it parses, and will fail to parse > values that do not satisfy the facet constraints.</p> > > @@ -185,32 +187,33 @@ > > <p>Most XML editors will wrap long lines. So your</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><a></span>foobar<span > class="nt"></a></span> > -</code></pre> > - </div> > + <p><code class="highlighter-rouge">xml > +<a>foobar</a> > +</code></p> > > <p>just might get turned into</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><a></span>foobar > -<span class="nt"></a></span> > -</code></pre> > - </div> > + <p><code class="highlighter-rouge">xml > +<a>foobar > +</a> > +</code></p> > > <p>Now most of the time that is fine. But sometimes the whitespace really > matters. One such place is when you type a regular expression. In DFDL this > can come up in this way:</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><dfdl:assert</span> <span > class="na">testKind=</span><span class="s">"pattern"</span><span > class="nt">></span> *<span class="nt"></dfdl:assert></span> > -</code></pre> > - </div> > + <p>``` xml</p> > + <dfdl:assert testkind="pattern"> *</dfdl:assert> > + <p>```</p> > > <p>Now the contents of that element is “ *”, i.e., a single space, and the > “*” character. That means zero or more spaces in regex language. If you don’t > want your XML tooling to mess with the whitespace do this instead:</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><dfdl:assert</span> <span > class="na">testKind=</span><span class="s">"pattern"</span><span > class="nt">></span><span class="cp"><![CDATA[ *]]></span><span > class="nt"></dfdl:assert></span> > -</code></pre> > - </div> > + <p>``` xml</p> > + <dfdl:assert testkind="pattern"><![CDATA[ *]]></dfdl:assert> > + <p>```</p> > > <p>CDATA informs XML processors that you very much care about this. Any > decent XML tooling/editor will see this and decide it cannot line-wrap this > or in any way mess with the whitespace. Also useful if you want to write a > complex DFDL expression in the expression language, and you want indentation > and lines to be respected. Here’s an example:</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span > class="nt"><dfdl:discriminator></span><span class="cp"><![CDATA[{ > + <p>``` xml</p> > + <dfdl:discriminator><![CDATA[{ > if (daf:trace((daf:trace(../../ex:presenceBit,"presenceBit") = > 0),"pbIsZero")) then false() > else if > (daf:trace(daf:trace(dfdl:occursIndex(),"occursIndex") = > 1,"indexIsOne")) then true() > @@ -221,13 +224,12 @@ > "priorRepeatBitIsZero")) > then false() > else true() > -}]]></span><span class="nt"></dfdl:discriminator></span> > -</code></pre> > - </div> > +}]]></dfdl:discriminator> > + <p>```</p> > > <p>If you get done writing something very deeply nested like this (and > XPath style languages require this all the time), then you do NOT want > anything messing with the whitespace.</p> > > - <p>About the xml:space=’preserve’ attribute: According to this thread on > the stack overflow web site, xml:space is only about whitespace-only nodes, > not nodes that are part whitespace. Within element-only content, the text > nodes found between the elements are whitespace-only nodes. Unless you use > xml:space=’preserve’, those are eliminated. None of the above discussion is > about whitespace-only nodes. It’s about value nodes containing text strings > with surrounding whitespace.</p> > + <p>About the xml:space=’preserve’ attribute: According to <a > href="http://www.xmlplease.com/xml/xmlspace/">this page</a>, xml:space is > only about whitespace-only nodes, not nodes that are part whitespace. Within > element-only content, the text nodes found between the elements are > whitespace-only nodes. Unless you use xml:space=’preserve’, those are > eliminated. None of the above discussion is about whitespace-only nodes. It’s > about value nodes containing text strings with surrounding whi [...] > </div> > > <p><a class="question" data-toggle="collapse" data-target="#faq4"> > @@ -295,34 +297,34 @@ If the things are potentially out of order, especially > if the lengths are not st > > <p>Consider the common “comma separated values” or CSV formats. If you > have</p> > > - <div class="highlighter-rouge"><pre class="highlight"><code>Name, Address, > Phone > + <p><code class="highlighter-rouge"> > +Name, Address, Phone > Mike, 8840 Standford Blvd\, Columbia MD, 888-888-8888 > -</code></pre> > - </div> > +</code></p> > > <p>and you want</p> > > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><columnNames></span> > - <span class="nt"><name></span>Name<span > class="nt"></name></span> > - <span class="nt"><name></span>Address<span > class="nt"></name></span> > - <span class="nt"><name></span>Phone<span > class="nt"></name></span> > -<span class="nt"></columnNames></span> > -<span class="nt"><row></span> > - <span class="nt"><col></span>Mike<span class="nt"></col></span> > - <span class="nt"><col></span>8840 Standford Blvd, Columbia MD<span > class="nt"></col></span> > - <span class="nt"><col></span>888-888-8888<span > class="nt"></col></span> > -<span class="nt"></row></span> > -</code></pre> > - </div> > - <p>That’s what you would get from a generic CSV DFDL schema. If you want > this:</p> > - > - <div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><row></span> > - <span class="nt"><Name></span>Mike<span > class="nt"></Name></span> > - <span class="nt"><Address></span>8840 Stanford Blvd, Columbia > MD<span class="nt"></Address></span> > - <span class="nt"><Phone></span>888-888-8888<span > class="nt"></Phone></span> > -<span class="nt"></row></span> > -</code></pre> > - </div> > + <p>``` xml</p> > + <columnnames> > + <name>Name</name> > + <name>Address</name> > + <name>Phone</name> > +</columnnames> > + <row> > + <col />Mike > + <col />8840 Standford Blvd, Columbia MD > + <col />888-888-8888 > +</row> > + <p>``` > +That’s what you would get from a generic CSV DFDL schema. If you want > this:</p> > + > + <p>``` xml</p> > + <row> > + <name>Mike</name> > + <address>8840 Stanford Blvd, Columbia MD</address> > + <phone>888-888-8888</phone> > +</row> > + <p>```</p> > > <p>That’s a specific-to-exactly-these-column-names CSV DFDL schema that is > required. If you have lots of files with this exact structure you would > create this DFDL schema once.</p> > > diff --git a/content/infoset/index.html b/content/infoset/index.html > index 4726e48..5077c44 100644 > --- a/content/infoset/index.html > +++ b/content/infoset/index.html > @@ -546,9 +546,9 @@ documents that contain only the mapped PUA corresponding > characters.</p> > > <p>These are the legal XML characters (for XML v1.0):</p> > > -<div class="highlighter-rouge"><pre class="highlight"><code>#x0 | #x9 | #xA > | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] | #xD (treated > specially) > -</code></pre> > -</div> > +<p><code class="highlighter-rouge"> > +#x0 | #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] > | #xD (treated specially) > +</code></p> > > <p>Illegal characters from <code class="highlighter-rouge">#x00</code> to > <code class="highlighter-rouge">#x1F</code> are mapped to the PUA > by adding <code class="highlighter-rouge">#xE000</code> to their character > code.</p> > diff --git a/content/people/index.html b/content/people/index.html > index 84e472e..ba76c5a 100644 > --- a/content/people/index.html > +++ b/content/people/index.html > @@ -164,7 +164,7 @@ > <td>vtguy08</td> > <td><a href="http://github.com/VTGuy">VTGuy</a></td> > <td>PPMC</td> > - <td>Tresys Technology</td> > + <td>Strategic Business Systems (SBS)</td> > </tr> > > </table> > diff --git a/content/tdml/index.html b/content/tdml/index.html > index 30337df..8935c6a 100644 > --- a/content/tdml/index.html > +++ b/content/tdml/index.html > @@ -113,114 +113,85 @@ when used with the TDML “tutorial” feature.</p> > > <p>Below is an annotated TDML file for a very simple example:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="cp"><?xml version="1.0" > encoding="ASCII"?></span> > - > -<span class="nt"><tdml:testSuite</span> > - <span class="na">suiteName=</span><span class="s">"Bug Report TDML > Template"</span> > - <span class="na">description=</span><span class="s">"Illustration of TDML > for bug reporting."</span> > - <span class="na">xmlns:tdml=</span><span > class="s">"http://www.ibm.com/xmlns/dfdl/testData"</span> > - <span class="na">xmlns:xsi=</span><span > class="s">"http://www.w3.org/2001/XMLSchema-instance"</span> > - <span class="na">xmlns:xml=</span><span > class="s">"http://www.w3.org/XML/1998/namespace"</span> > - <span class="na">xmlns:dfdl=</span><span > class="s">"http://www.ogf.org/dfdl/dfdl-1.0/"</span> > - <span class="na">xmlns:xs=</span><span > class="s">"http://www.w3.org/2001/XMLSchema"</span> > - <span class="na">xmlns:ex=</span><span > class="s">"http://example.com"</span> > - <span class="na">xmlns:gpf=</span><span > class="s">"http://www.ibm.com/dfdl/GeneralPurposeFormat"</span> > - <span class="na">xmlns:daf=</span><span > class="s">"urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"</span> > - <span class="na">xmlns=</span><span > class="s">"http://www.w3.org/1999/xhtml"</span> > - <span class="na">xsi:schemaLocation=</span><span > class="s">"http://www.ibm.com/xmlns/dfdl/testData tdml.xsd"</span> > - <span class="na">defaultRoundTrip=</span><span > class="s">"false"</span><span class="nt">></span> > +<p>```xml > +<?xml version="1.0" encoding="ASCII"?></p> > + > +<tdml:testsuite suitename="Bug Report TDML Template" > description="Illustration of TDML for bug reporting." > xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xml="http://www.w3.org/XML/1998/namespace" > xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" > xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ex="http://example.com" > xmlns:gpf="http://www.ibm.com/dfdl/GeneralPurposeFormat" > xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org [...] > > - <span class="c"><!-- > + <!-- > This example TDML file is for a self-contained bug report. > > It shows the definition of an inline schema and parse test and unparse > test that use that schema. > - --></span> > + --> > > - <span class="c"><!-- > + <!-- > A DFDL schema is defined inside the tdml:defineSchema element. The > contents > are similar to a normal DFDL schema, allowing for imports, defining a > global format via dfdl:defineFormat and dfdl:format, and defining schema > xs:elements/groups/types/etc. > - --></span> > + --> > > - <span class="nt"><tdml:defineSchema</span> <span > class="na">name=</span><span class="s">"bug01Schema"</span> <span > class="na">elementFormDefault=</span><span > class="s">"unqualified"</span><span class="nt">></span> > + <tdml:defineschema name="bug01Schema" elementformdefault="unqualified"> > > - <span class="nt"><xs:import</span> > - <span class="na">namespace=</span><span > class="s">"http://www.ibm.com/dfdl/GeneralPurposeFormat"</span> > - <span class="na">schemaLocation=</span><span > class="s">"IBMdefined/GeneralPurposeFormat.xsd"</span> <span > class="nt">/></span> > + <xs:import namespace="http://www.ibm.com/dfdl/GeneralPurposeFormat" > schemalocation="IBMdefined/GeneralPurposeFormat.xsd" /> > > - <span class="nt"><dfdl:defineFormat</span> <span > class="na">name=</span><span class="s">"myFormat"</span><span > class="nt">></span> > - <span class="nt"><dfdl:format</span> <span > class="na">ref=</span><span class="s">"gpf:GeneralPurposeFormat"</span> > - <span class="na">lengthKind=</span><span class="s">"implicit"</span> > - <span class="na">representation=</span><span class="s">"text"</span> > - <span class="na">encoding=</span><span class="s">"ASCII"</span> > - <span class="na">initiator=</span><span class="s">""</span> > - <span class="na">terminator=</span><span class="s">""</span> > - <span class="na">separator=</span><span class="s">""</span> <span > class="nt">/></span> > - <span class="nt"></dfdl:defineFormat></span> > + <dfdl:defineformat name="myFormat"> > + <dfdl:format ref="gpf:GeneralPurposeFormat" lengthkind="implicit" > representation="text" encoding="ASCII" initiator="" terminator="" > separator="" /> > + </dfdl:defineformat> > > - <span class="nt"><dfdl:format</span> <span > class="na">ref=</span><span class="s">"ex:myFormat"</span> <span > class="nt">/></span> > + <dfdl:format ref="ex:myFormat" /> > > - <span class="nt"><xs:element</span> <span > class="na">name=</span><span class="s">"myTestRoot"</span> <span > class="na">type=</span><span class="s">"xs:dateTime"</span> > - <span class="na">dfdl:calendarPattern=</span><span > class="s">"MM.dd.yyyy 'at' HH:mm:ssZZZZZ"</span> > - <span class="na">dfdl:calendarPatternKind=</span><span > class="s">"explicit"</span> > - <span class="na">dfdl:lengthKind=</span><span > class="s">"delimited"</span> > - <span class="na">dfdl:terminator=</span><span class="s">"%NL;"</span> > <span class="nt">/></span> > + <xs:element name="myTestRoot" type="xs:dateTime" > dfdl:calendarpattern="MM.dd.yyyy 'at' HH:mm:ssZZZZZ" > dfdl:calendarpatternkind="explicit" dfdl:lengthkind="delimited" > dfdl:terminator="%NL;" /> > > - <span class="nt"></tdml:defineSchema></span> > + </tdml:defineschema> > > - <span class="c"><!-- > + <!-- > Define a parse test case, using the above schema and root element. Input > data is defined along with the expected infoset. > - --></span> > + --> > > - <span class="nt"><tdml:parserTestCase</span> <span > class="na">name=</span><span class="s">"dateTimeTest"</span> <span > class="na">root=</span><span class="s">"myTestRoot"</span> <span > class="na">model=</span><span class="s">"bug01Schema"</span> > - <span class="na">description=</span><span class="s">"A hypothetical bug > illustration about parsing a date time."</span><span class="nt">></span> > + <tdml:parsertestcase name="dateTimeTest" root="myTestRoot" > model="bug01Schema" description="A hypothetical bug illustration about > parsing a date time."> > > - <span class="nt"><tdml:document></span> > - <span class="nt"><tdml:documentPart</span> <span > class="na">type=</span><span class="s">"text"</span> > - <span class="na">replaceDFDLEntities=</span><span > class="s">"true"</span><span class="nt">></span><span > class="cp"><![CDATA[04.02.2013 at 14:00:56 GMT-05:00%LF;]]></span><span > class="nt"></tdml:documentPart></span> > - <span class="nt"></tdml:document></span> > + <tdml:document> > + <tdml:documentpart type="text" > replacedfdlentities="true"><![CDATA[04.02.2013 at 14:00:56 > GMT-05:00%LF;]]></tdml:documentpart> > + </tdml:document> > > - <span class="nt"><tdml:infoset></span> > - <span class="nt"><tdml:dfdlInfoset></span> > - <span > class="nt"><ex:myTestRoot></span>2013-04-02T14:00:56.000000-05:00<span > class="nt"></ex:myTestRoot></span> > - <span class="nt"></tdml:dfdlInfoset></span> > - <span class="nt"></tdml:infoset></span> > + <tdml:infoset> > + <tdml:dfdlinfoset> > + <ex:mytestroot>2013-04-02T14:00:56.000000-05:00</ex:mytestroot> > + </tdml:dfdlinfoset> > + </tdml:infoset> > > - <span class="nt"></tdml:parserTestCase></span> > + </tdml:parsertestcase> > > - <span class="c"><!-- > + <!-- > Define an unparse test case, using the above schema and root element. An > input infoset is defined along with the expected unparsed data. > - --></span> > + --> > > - <span class="nt"><tdml:unparserTestCase</span> <span > class="na">name=</span><span class="s">"unparseDateTimeTest"</span> <span > class="na">root=</span><span class="s">"myTestRoot"</span> <span > class="na">model=</span><span class="s">"bug01Schema"</span> > - <span class="na">description=</span><span class="s">"Another bug > illustration, this time unparsing direction."</span><span > class="nt">></span> > + <tdml:unparsertestcase name="unparseDateTimeTest" root="myTestRoot" > model="bug01Schema" description="Another bug illustration, this time > unparsing direction."> > > - <span class="nt"><tdml:infoset></span> > - <span class="nt"><tdml:dfdlInfoset></span> > - <span > class="nt"><ex:myTestRoot></span>2013-04-02T14:00:56.000000-05:00<span > class="nt"></ex:myTestRoot></span> > - <span class="nt"></tdml:dfdlInfoset></span> > - <span class="nt"></tdml:infoset></span> > + <tdml:infoset> > + <tdml:dfdlinfoset> > + <ex:mytestroot>2013-04-02T14:00:56.000000-05:00</ex:mytestroot> > + </tdml:dfdlinfoset> > + </tdml:infoset> > > - <span class="nt"><tdml:document></span> > - <span class="nt"><tdml:documentPart</span> <span > class="na">type=</span><span class="s">"text"</span> > - <span class="na">replaceDFDLEntities=</span><span > class="s">"true"</span><span class="nt">></span><span > class="cp"><![CDATA[04.02.2013 at 14:00:56-05:00%CR;%LF;]]></span><span > class="nt"></tdml:documentPart></span> > - <span class="nt"></tdml:document></span> > + <tdml:document> > + <tdml:documentpart type="text" > replacedfdlentities="true"><![CDATA[04.02.2013 at > 14:00:56-05:00%CR;%LF;]]></tdml:documentpart> > + </tdml:document> > > - <span class="nt"></tdml:unparserTestCase></span> > + </tdml:unparsertestcase> > > -<span class="nt"></tdml:testSuite></span> > -</code></pre> > -</div> > +</tdml:testsuite> > +<p>```</p> > > <p>Suppose you save the above out as a file <code > class="highlighter-rouge">myDateTimeBug.tdml</code>. You can then run > it using the <code class="highlighter-rouge">test</code> subcommand of the > <a href="/cli">Daffodil Command Line Interface</a>:</p> > > -<div class="highlighter-rouge"><pre class="highlight"><code>$ daffodil test > myDateTimeBug.tdml > -</code></pre> > -</div> > +<p><code class="highlighter-rouge"> > +$ daffodil test myDateTimeBug.tdml > +</code></p> > > <h3 id="specifying-test-data">Specifying Test Data</h3> > > @@ -229,8 +200,9 @@ external file by setting the <code > class="highlighter-rouge">type</code> attribu > element. Multiple <code class="highlighter-rouge">tdml:documentPart</code> > elements are combined to create the > test data. The different documentPart types are illustrated below.</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><tdml:document></span> > - <span class="c"><!-- > +<p>```xml</p> > +<tdml:document> > + <!-- > A document part with type="text" is text. It is often a good idea to use > CDATA to avoid whitespace changes made by some autoindenting IDE's. > > @@ -248,13 +220,13 @@ test data. The different documentPart types are > illustrated below.</p> > > If you want to use DFDL character entities, you must turn on the > replaceDFDLEntities="true" feature of the documentPart element. > - --></span> > + --> > > - <span class="nt"><tdml:documentPart</span> <span > class="na">type=</span><span class="s">"text"</span><span > class="nt">></span><span class="cp"><![CDATA[quantity:250; > + <tdml:documentpart type="text"><![CDATA[quantity:250; > hardnessRating:967; > -]]></span><span class="nt"></tdml:documentPart></span> > +]]></tdml:documentpart> > > - <span class="c"><!-- > + <!-- > In 'text' both XML character entities, and DFDL's own character entities > are interpreted. > > @@ -267,44 +239,42 @@ hardnessRating:967; > 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. > - --></span> > + --> > > - <span class="nt"><tdml:documentPart</span> <span > class="na">type=</span><span class="s">"text"</span> > - <span class="na">replaceDFDLEntities=</span><span > class="s">"true"</span><span class="nt">></span><span > class="cp"><![CDATA[1987&#x5E74;10&#x6708;&#x65e5; > BCE%NUL;]]></span><span class="nt"></tdml:documentPart></span> > + <tdml:documentpart type="text" > replacedfdlentities="true"><![CDATA[1987年10月日 > BCE%NUL;]]></tdml:documentpart> > > - <span class="c"><!-- > + <!-- > Type 'byte' means use hexadecimal to specify the data. Freeform > whitespace > is allowed and 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. > - --></span> > + --> > > - <span class="nt"><tdml:documentPart</span> <span > class="na">type=</span><span class="s">"byte"</span><span > class="nt">></span> > + <tdml:documentpart type="byte"> > 9Abf e4c3 > A5-E9-FF-00 > - <span class="nt"></tdml:documentPart></span> > + </tdml:documentpart> > > - <span class="c"><!-- > + <!-- > 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. > - --></span> > + --> > > - <span class="nt"><tdml:documentPart</span> <span > class="na">type=</span><span class="s">"bits"</span><span > class="nt">></span> > + <tdml:documentpart type="bits"> > 1.110 0.011 1 First 5 bit fields. > - <span class="nt"></tdml:documentPart></span> > + </tdml:documentpart> > > - <span class="c"><!-- > + <!-- > Type 'file' means the content is a file name where to get the data > - --></span> > + --> > > - <span class="nt"><tdml:documentPart</span> <span > class="na">type=</span><span class="s">"file"</span><span > class="nt">></span>/some/directory/testData.in.dat<span > class="nt"></tdml:documentPart></span> > + <tdml:documentpart > type="file">/some/directory/testData.in.dat</tdml:documentpart> > > -<span class="nt"></tdml:document></span> > -</code></pre> > -</div> > -<p>Note that in order for a test to be considered successful, it must > consume all > +</tdml:document> > +<p>``` > +Note that in order for a test to be considered successful, it must consume > all > the data defined in the <code class="highlighter-rouge">tdml:document</code> > element. Otherwise the test will fail > with a message about “left over data”.</p> > > @@ -314,17 +284,17 @@ with a message about “left over data”.</p> > external file by setting the <code class="highlighter-rouge">type</code> > attribute on the <code class="highlighter-rouge">tdml:dfdlInfoset</code> > element. If not provided, the type defaults to inline XML. For example:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><tdml:infoset></span> > - <span class="nt"><tdml:dfdlInfoset</span> <span > class="na">type=</span><span class="s">"infoset"</span><span > class="nt">></span> > - <span > class="nt"><ex:myTestRoot></span>2013-04-02T14:00:56.000000-05:00<span > class="nt"></ex:myTestRoot></span> > - <span class="nt"></tdml:dfdlInfoset></span> > -<span class="nt"></tdml:infoset></span> > +<p>```xml</p> > +<tdml:infoset> > + <tdml:dfdlinfoset type="infoset"> > + <ex:mytestroot>2013-04-02T14:00:56.000000-05:00</ex:mytestroot> > + </tdml:dfdlinfoset> > +</tdml:infoset> > > -<span class="nt"><tdml:infoset></span> > - <span class="nt"><tdml:dfdlInfoset</span> <span > class="na">type=</span><span class="s">"file"</span><span > class="nt">></span>/some/directory/testData.in.xml<span > class="nt"></tdml:dfdlInfoset></span> > -<span class="nt"></tdml:infoset></span> > -</code></pre> > -</div> > +<tdml:infoset> > + <tdml:dfdlinfoset > type="file">/some/directory/testData.in.xml</tdml:dfdlinfoset> > +</tdml:infoset> > +<p>```</p> > > <p>Note that the <code class="highlighter-rouge">tdml:dfdlInfoset</code> may > need to contain characters that are not > legal in XML documents. Daffodil remaps these characters into legal XML > @@ -338,12 +308,12 @@ TDML allows for creating negative tests to expect > errors and warnings. To do > expect errors, replace the <code > class="highlighter-rouge">tdml:infoset</code> element with a <code > class="highlighter-rouge">tdml:errors</code> > element:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><tdml:errors></span> > - <span class="nt"><tdml:error></span>Schema Definition Error<span > class="nt"></tdml:error></span> > - <span class="nt"><tdml:error></span>testElementName<span > class="nt"></tdml:error></span> > -<span class="nt"></tdml:errors></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<tdml:errors> > + <tdml:error>Schema Definition Error</tdml:error> > + <tdml:error>testElementName</tdml:error> > +</tdml:errors> > +<p>```</p> > > <p>Each <code class="highlighter-rouge">tdml:error</code> child element > contains a sub-string which must be found > somewhere in the set of diagnostic messages that come out of the test. The > @@ -354,12 +324,12 @@ counterparts to define warnings that should be created > during the test. Note > that warnings are considered non-fatal and so can appear alongside > <code class="highlighter-rouge">tdml:errors</code> and <code > class="highlighter-rouge">tdml:infoset</code> elements.</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><tdml:warnings></span> > - <span class="nt"><tdml:warning></span>Schema Definition Warning<span > class="nt"></tdml:warning></span> > - <span > class="nt"><tdml:warning></span>'http://www.ogf.org/dfdl/dfdl-1.0/' > should be 'http://www.ogf.org/dfdl/'<span > class="nt"></tdml:warning></span> > -<span class="nt"></tdml:warnings></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<tdml:warnings> > + <tdml:warning>Schema Definition Warning</tdml:warning> > + <tdml:warning>'http://www.ogf.org/dfdl/dfdl-1.0/' should be > 'http://www.ogf.org/dfdl/'</tdml:warning> > +</tdml:warnings> > +<p>```</p> > > <h3 id="using-cdata-regions">Using CDATA Regions</h3> > > @@ -368,19 +338,19 @@ Although in general is it used to easily include XML > special characters in XML > data, its use has other benefits in TDML files as well. Below are examples of > what scenarios when CDATA regions should and should not be used.</p> > > -<h4 id="-as-a-clear-way-represent-xml-special-characters"><i > class="glyphicon glyphicon-ok" style="color: #00d000;"></i> As a clear way > represent XML special characters</h4> > +<h4 > id="i-classglyphicon-glyphicon-ok-stylecolor-00d000i-nbspas-a-clear-way-represent-xml-special-characters"><i > class="glyphicon glyphicon-ok" style="color: #00d000;"></i> As a clear way > represent XML special characters</h4> > > <p>The characters <code class="highlighter-rouge"><</code>, <code > class="highlighter-rouge">></code>, <code > class="highlighter-rouge">&</code>, <code > class="highlighter-rouge">'</code>, and <code > class="highlighter-rouge">"</code> must be represented in XML > with <code class="highlighter-rouge">&lt;</code>, <code > class="highlighter-rouge">&gt;</code>, <code > class="highlighter-rouge">&amp;</code>, <code > class="highlighter-rouge">&apos;</code>, and <code > class="highlighter-rouge">&quot;</code>, respectively. > These special characters are not escaped when used in CDATA tags, which can > make the data more clear. For example, the following are equivalent:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><foo></span>abc<span > class="ni">&amp;&amp;&amp;</span>>def<span > class="nt"></foo></span> > -<span class="nt"><foo></span>abc<span > class="cp"><![CDATA[&&&]]></span>def<span > class="nt"></foo></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<foo>abc&&&>def</foo> > +<foo>abc<![CDATA[&&&]]>def</foo> > +<p>```</p> > > -<h4 > id="-to-preserve-textual-formatting-within-tdml---for-clarity-reasons"><i > class="glyphicon glyphicon-ok" style="color: #00d000;"></i> To preserve > textual formatting within TDML - for clarity reasons</h4> > +<h4 > id="i-classglyphicon-glyphicon-ok-stylecolor-00d000i-nbspto-preserve-textual-formatting-within-tdml---for-clarity-reasons"><i > class="glyphicon glyphicon-ok" style="color: #00d000;"></i> To preserve > textual formatting within TDML - for clarity reasons</h4> > > <p>Often times IDE’s and XML editors will indent, wrap, and remove redundant > whitespace in XML data. However, sometimes it is desired that such formatting > @@ -388,43 +358,43 @@ is maintained for readability purposes. Many tools > refuse to perform > modifications on CDATA regions, so they can be used as a way to maintain > formatting. For example:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><tdml:documentPart</span> <span > class="na">type=</span><span class="s">"byte"</span><span > class="nt">></span><span class="cp"><![CDATA[ > +<p>```xml</p> > +<tdml:documentpart type="byte"><![CDATA[ > 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f > 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f > 20 21 23 24 25 27 28 29 2a 2b 2c 2d 2e 2f > 30 31 32 33 34 35 36 37 38 39 3a 3b 3d 3f > 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f > 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f > -]]></span><span class="nt"></tdml:documentPart></span> > -</code></pre> > -</div> > +]]></tdml:documentpart> > +<p>```</p> > > <p>The data holes in the above matrix of hex would be hard to understand > without > the formatting. But logically, the whitespace is irrelevant when the > documentPart type is “byte”. In effect, we have CDATA here so that tooling > like > IDEs, XML editor, etc. will not mess with the formatting of the content.</p> > > -<h4 > id="-to-avoid-insertion-of-whitespace-that-would-make-things-incorrect"><i > class="glyphicon glyphicon-ok" style="color: #00d000;"></i> To avoid > insertion of whitespace that would make things incorrect</h4> > +<h4 > id="i-classglyphicon-glyphicon-ok-stylecolor-00d000i-nbspto-avoid-insertion-of-whitespace-that-would-make-things-incorrect"><i > class="glyphicon glyphicon-ok" style="color: #00d000;"></i> To avoid > insertion of whitespace that would make things incorrect</h4> > > <p>Let us assume that the input document should contain exactly two letters: > <code class="highlighter-rouge">a年</code>. This might be represented as the > following in a TDML file:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><document></span> > - <span class="nt"><documentPart</span> <span > class="na">type=</span><span class="s">"text"</span><span > class="nt">></span>a年<span class="nt"></documentPart></span> > -<span class="nt"></document></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<document> > + <documentpart type="text">a年</documentpart> > +</document> > +<p>```</p> > > <p>The problem is that it is possible that an XML tool might reformat the > XML as > this:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><document></span> > - <span class="nt"><documentPart</span> <span > class="na">type=</span><span class="s">"text"</span><span > class="nt">></span> > +<p>```xml</p> > +<document> > + <documentpart type="text"> > a年 > - <span class="nt"></documentPart></span> > -<span class="nt"></document></span> > -</code></pre> > -</div> > + </documentpart> > +</document> > +<p>```</p> > > <p>But this is a text documentPart containing some letters with surrounding > whitespace. Our test, in this case, expects data of length exactly 2 > @@ -432,20 +402,20 @@ characters, so could cause a failure. CDATA can be used > to prevent many XML > tools from reformatting and inserting whitespace that could affect the test > input data:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><document></span> > - <span class="nt"><documentPart</span> <span > class="na">type=</span><span class="s">"text"</span><span > class="nt">></span><span class="cp"><![CDATA[a年]]></span><span > class="nt"></documentPart></span> > -<span class="nt"></document></span> > -</code></pre> > -</div> > -<h4 id="-to-preserve-specific-line-endings"><i class="glyphicon > glyphicon-remove" style="color: #d00000;"></i> To preserve specific line > endings</h4> > +<p>```xml</p> > +<document> > + <documentpart type="text"><![CDATA[a年]]></documentpart> > +</document> > +<p>``` > +#### <i class="glyphicon glyphicon-remove" style="color: #d00000;"></i> To > preserve specific line endings</p> > > <p>Using CDATA does NOT necessarily preserve line endings. So if you had a > test > where you have this:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><documentPart</span> <span > class="na">type=</span><span class="s">"text"</span><span > class="nt">></span><span class="cp"><![CDATA[Text followed by a CR LF > -]]></span><span class="nt"></documentPart></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<documentpart type="text"><![CDATA[Text followed by a CR LF > +]]></documentpart> > +<p>```</p> > > <p>If you edit that on a windows machine, where CRLF is the usual text line > ending, then the file will actually have a CRLF line ending in that text. If > @@ -459,20 +429,20 @@ line endings.</p> > using the numeric character entity notation, i.e., <code > class="highlighter-rouge">&#xD;</code>. So one might try to > write the above test as:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><documentPart</span> <span > class="na">type=</span><span class="s">"text"</span><span > class="nt">></span><span class="cp"><![CDATA[Text followed by a CR > LF]]></span><span class="nt"></documentPart></span> > -<span class="nt"><documentPart</span> <span class="na">type=</span><span > class="s">"text"</span><span class="nt">></span><span > class="ni">&#xD;&#xA;</span><span > class="nt"></documentPart></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<documentpart type="text"><![CDATA[Text followed by a CR > LF]]></documentpart> > +<documentpart type="text">
</documentpart> > +<p>```</p> > > <p>Even this, however, is not a sure thing, because re-indenting the XML > might > cause you to get:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><documentPart</span> <span > class="na">type=</span><span class="s">"text"</span><span > class="nt">></span><span class="cp"><![CDATA[Text followed by a CR > LF]]></span><span class="nt"></documentPart></span> > -<span class="nt"><documentPart</span> <span class="na">type=</span><span > class="s">"text"</span><span class="nt">></span> > - <span class="ni">&#xD;&#xA;</span> > -<span class="nt"></documentPart></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<documentpart type="text"><![CDATA[Text followed by a CR > LF]]></documentpart> > +<documentpart type="text"> > + 
 > +</documentpart> > +<p>```</p> > > <p>Which would be broken because of the whitespace insertions around the > <code class="highlighter-rouge">&#xD;&#xA;</code>.</p> > @@ -480,10 +450,10 @@ cause you to get:</p> > <p>There are two good solutions to this problem. First one can use > type=”byte” > document parts:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><documentPart</span> <span > class="na">type=</span><span class="s">"text"</span><span > class="nt">></span><span class="cp"><![CDATA[Text followed by a CR > LF]]></span><span class="nt"></documentPart></span> > -<span class="nt"><documentPart</span> <span class="na">type=</span><span > class="s">"byte"</span><span class="nt">></span>0D 0A<span > class="nt"></documentPart></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<documentpart type="text"><![CDATA[Text followed by a CR > LF]]></documentpart> > +<documentpart type="byte">0D 0A</documentpart> > +<p>```</p> > > <p>This will always create exactly the bytes <code > class="highlighter-rouge">0D</code> and <code > class="highlighter-rouge">0A</code>, and documentParts > are concatenated together with nothing between. However, this will break if > the > @@ -495,9 +465,9 @@ only 7 bits, resulting in 14 bits rather than 2 full > bytes.</p> > <p>The best way to handle this problem is to use the documentPart > replaceDFDLEntities attribute:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><documentPart</span> <span > class="na">type=</span><span class="s">"text"</span> <span > class="na">replaceDFDLEntities=</span><span class="s">"true"</span><span > class="nt">></span><span class="cp"><![CDATA[Text followed by a CR > LF%CR;%LF;]]></span><span class="nt"></documentPart></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<documentpart type="text" replacedfdlentities="true"><![CDATA[Text > followed by a CR LF%CR;%LF;]]></documentpart> > +<p>```</p> > > <p>The line gets kind of long, but those <code > class="highlighter-rouge">%CR;</code> and <code > class="highlighter-rouge">%LF;</code> are DFDL entities > syntax for those Unicode characters. These are translated into whatever > @@ -508,11 +478,11 @@ encoding is say, UTF-16 or the 7-bit encoding.</p> > a bit clumsy as you have to do it like this where each text line gets its own > documentPart:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><documentPart</span> <span > class="na">type=</span><span class="s">"text"</span> <span > class="na">replaceDFDLEntities=</span><span class="s">"true"</span><span > class="nt">></span><span class="cp"><![CDATA[Of all the gin > joints%CR;%LF;]]></span><span class="nt"></documentPart></span> > -<span class="nt"><documentPart</span> <span class="na">type=</span><span > class="s">"text"</span> <span class="na">replaceDFDLEntities=</span><span > class="s">"true"</span><span class="nt">></span><span > class="cp"><![CDATA[In all the towns in the > world%CR;%LF;]]></span><span class="nt"></documentPart></span> > -<span class="nt"><documentPart</span> <span class="na">type=</span><span > class="s">"text"</span> <span class="na">replaceDFDLEntities=</span><span > class="s">"true"</span><span class="nt">></span><span > class="cp"><![CDATA[She walked into mine%CR;%LF;]]></span><span > class="nt"></documentPart></span> > -</code></pre> > -</div> > +<p>```xml</p> > +<documentpart type="text" replacedfdlentities="true"><![CDATA[Of all the > gin joints%CR;%LF;]]></documentpart> > +<documentpart type="text" replacedfdlentities="true"><![CDATA[In all the > towns in the world%CR;%LF;]]></documentpart> > +<documentpart type="text" replacedfdlentities="true"><![CDATA[She walked > into mine%CR;%LF;]]></documentpart> > +<p>```</p> > > <p>So the general rule is that CDATA regions cannot be used to ensure that > specific kinds of line endings will be preserved in a file.</p> > @@ -525,12 +495,12 @@ preserve <em>some</em> line endings. If this same test > example was instead using > some other obscure Unicode line ending characters. In that case, the original > documentPart XML:</p> > > -<div class="language-xml highlighter-rouge"><pre > class="highlight"><code><span class="nt"><documentPart</span> <span > class="na">type=</span><span class="s">"text"</span><span > class="nt">></span><span class="cp"><![CDATA[Of all the gin joints > +<p>```xml</p> > +<documentpart type="text"><![CDATA[Of all the gin joints > In all the towns of the world > She walked into mine > -]]></span><span class="nt"></documentPart></span> > -</code></pre> > -</div> > +]]></documentpart> > +<p>```</p> > > <p>is fine, and will work and be robust.</p> > >
