Alan

I think empty must really mean empty - no sequence initiator or separator(s) or terminator. If you have any of those then there is content, the complex element is there, and you apply defaulting to the children.  

I struggled with the tables.  I've changed them both.


Defaulting for required complex element on parsing
initiator region
content region
infoset contains
matching
not empty
 default values exist for all required content
complex element with child elements (real values)
matching
empty
 default values exist for all required content
emptyValueDelimiterPolicy
must be
initiator or both
complex element with child elements (default values)
empty
not empty
default values exist for any missing required content
Initiator must not be specified
complex element with child elements (real values)
empty
empty
default values exist for all required content
emptyValueDelimiterPolicy
must be
none

or

Initiator
must not be specified
complex element with child elements (default values)




Defaulting for required complex element on unparsing
infoset contains
initiator region contains
content region contains
not supplied

supplied but with no children

supplied with some children
default values exist for all missing required content but final representation of complex element is empty string
emptyValueDelimiterPolicy
none
or
Initiator must not be specified
empty
empty
emptyValueDelimiterPolicy
initiator or both
initiator string
default values exist for all missing required content but final representation of complex element is not empty string
initiator string if specified
 representation of complex element and its children


Regards

Steve Hanson
Strategy, Common Transformation & DFDL
Co-Chair, OGF DFDL WG
IBM SWG, Hursley, UK,
smh@uk.ibm.com,
tel +44-(0)1962-815848



From: Alan Powell/UK/IBM@IBMGB
To: dfdl-wg@ogf.org
Date: 30/04/2010 16:26
Subject: [DFDL-WG] Action 086: Nils and Defaults for complex elements
Sent by: dfdl-wg-bounces@ogf.org






Part of Action 086 is to apply the clarified Nils and Defaulting rules to complex elements and develop some examples.


The tables for parsing and unparsing are simpler because there is no need to consider nillable.


I have assumed

-  emptyValueDelimiterPolicy does apply to complex elements.

- on parsing a complex element is empty if its children's content is empty. That is the child delimiters may be present.

- on unparsing defaulting occurs if a complex item is missing or present present but has no children.


Defaulting for complex elements on parsing
initiator region
content region
Logical Value
matching
Not empty
parsed children
matching
empty
 A default is specified
emptyValueDelimiterPolicy
must be
initiator or both
default value
of children
empty
Not empty
Initiator must not be specified
parsed children
empty
empty
A default is specified
emptyValueDelimiterPolicy
must be
none

or

Initiator
must not be specified
default value
of children




Defaulting for complex elements on unparsing
Logical Value
initiator region contains
content region contains
Missing or present with no children
default of all children is empty string
emptyValueDelimiterPolicy
none
empty
empty
emptyValueDelimiterPolicy
initiator or both
initiator string
default of any child is not empty string
initiator string
 representation of the child default value.
a least on child exists
initiator string
representation of children



Examples

Defaulting Complex types

ONE:one,
TWO:

  TWOONE:twoone;

  TWOTWO:twotwo;

  TWOTHREE:twothree,

THREE:three

<end>



In the following TWO is 'empty' (when relevant dfdl properties are set)


ONE:one,THREE:three<end>

|separatorPolicy='suppressed', emptyValueDelimiterPolicy='none'


ONE:one,,THREE:three<end>

separatorPolicy='required', emptyValueDelimiterPolicy='none'


ONE:one<end>

separatorPolicy='suppressed' or 'suppressedAtEnd', emptyValueDelimiterPolicy='none'


<end>

separatorPolicy='suppressed' or 'suppressedAtEnd', emptyValueDelimiterPolicy='none'


ONE:one,TWO:,THREE:three<end>

separatorPolicy= don't care , emptyValueDelimiterPolicy='initiator'


ONE:one,TWO:<end>

separatorPolicy= 'suppressed' or 'suppressedAtEnd', emptyValueDelimiterPolicy='initiator'


ONE:one,TWO:,<end>

separatorPosition='postfix'
separatorPolicy= 'suppressed' or 'suppressedAtEnd', emptyValueDelimiterPolicy='initiator'


*** Should 'postfix' separator be there when 'supressedAtEnd'  ***


ONE:one,TWO:TWOONE:,THREE:three<end>

separatorPolicy= 'suppressed' or 'suppressedAtEnd', (TWO)emptyValueDelimiterPolicy='initiator'

(TWOONE)emptyValueDelimiterPolicy='initiator'



ONE:one,TWOONE:,THREE:three<end>

separatorPolicy= 'suppressed' or 'suppressedAtEnd', (TWO)emptyValueDelimiterPolicy='none'

(TWOONE)emptyValueDelimiterPolicy='initiator'


*** We should discuss this example. ***
 
Regards
 
Alan Powell
 
Development - MQSeries, Message Broker, ESB
IBM Software Group, Application and Integration Middleware Software
-------------------------------------------------------------------------------------------------------------------------------------------
IBM
MP211, Hursley Park
Hursley, SO21 2JN
United Kingdom
Phone: +44-1962-815073
e-mail: alan_powell@uk.ibm.com







Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU





--
 dfdl-wg mailing list
 dfdl-wg@ogf.org
 
http://www.ogf.org/mailman/listinfo/dfdl-wg








Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU