Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

This page for questions about DFDL.

 

Is there a DFDL FAQ somewhere?

Yes....

...

Q: When should I use an XSD facet like maxLength, and when should I use the DFDL length property?

...

  Here's

...

part

...

of

...

an

...

example

...

from

...

the

...

DFDL

...

tutorial

...

of

...

a

...

street

...

address:

...

 

...

<xs:element

...

name="houseNumber"

...

type="xs:string"

...

dfdl:lengthKind="explicit"

...

dfdl:length="6"/>

  Note that the length of the house number is constrained with DFDL.  XSD can also be used to constrain lengths.

  When should you used XSD to do this, and when should you use DFDL?  Should you ever use both?

A: You must use the dfdl:length property, because it can't parse the data without it. You may use the XSD facets to check further, and it often makes sense to use both.

Consider

  <xs:element name="article" type="xs:string" dfdl:length="{ ../header/articleLength }" dfdl:lengthKind='explicit'/>

...