Hi Folks,

I have a data format with a field whose value is one of these strings: ABC or 
DEF or GHI.

If no data is available to populate the field, the field must contain a single 
hyphen.

I am using a regex to specify the field's content.

Question: What's the difference between specifying the field this way:

<xs:element name="Foo" 
        dfdl:lengthKind="pattern"
        dfdl:lengthPattern="(ABC|DEF|GHI)|-" ...

Notice that all properties dealing with nil are omitted. The nil value is part 
of the regex.

versus specifying the field this way:

<xs:element name="Foo" 
        nillable="true" 
        dfdl:nilKind="literalValue"
        dfdl:nilValue="-"
        dfdl:lengthKind="pattern"
        dfdl:lengthPattern="ABC|DEF|GHI"
        ...

Notice the regex doesn't specify a hyphen and the nil value is specified using 
the nil properties.

Do the two ways mean the same thing? I am guessing that technically they do not 
mean the same thing; but in practice they both result in constraining the field 
to the same set of allowable values, and therefore may be considered 
equivalent. Do you agree?

Do the two ways behave the same for parsing and unparsing?

If they are equivalent, which way is preferred?

/Roger 

Reply via email to