We need to create an action item for this topic:

In minutes of 2014-10-28 we took the position that 'x[1]' is allowed on scalars, and implementations can warn.

However,....

I just spotted this language in the latest DFDL spec, section 2.6

•    Expression Errors
Example: x[1] when x is declared and has both minOccurs="1" and maxOccurs="1" explicitly, or by not stating either or both of them.

Oops...

So it appears we already took a position on whether x[1] is allowed for scalars. It's not. It's a schema definition error.

However, this wording suggests x[1] allowed for optional elements - and this is redundant as just 'x' would be sufficient. To me that's ok, as when dfdl:occursCountKind='parsed' we don't use maxOccurs anyway, so any non-scalar is in fact treated as an array.

The issue here of course is not about the constant expression '1', but e.g., 'x[$myVar]', when $myVar might or might not have value 1 at runtime. In general you cannot tell.

If we believe there should be additional mention of this behavior later in the spec in section 23, then that could be added, but I don't think we should change this aspect of DFDL. I believe it actually makes implementations harder if one blurs the lines between scalars and arrays/optionals. Right now they are reasonably cleanly separated.

...mikeb



Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | www.tresys.com
Please note: Contributions to the DFDL Workgroup's email discussions are subject to the OGF Intellectual Property Policy


On Tue, Oct 28, 2014 at 2:06 PM, Steve Hanson <smh@uk.ibm.com> wrote:
Agreed on call not to add any extra restriction but a DFDL implementation is free to issue a warning if it detects such usage.

Regards
 
Steve Hanson
Architect,
IBM DFDL
Co-Chair,
OGF DFDL Working Group
IBM SWG, Hursley, UK

smh@uk.ibm.com
tel:+44-1962-815848




From:        Tim Kimber/UK/IBM@IBMGB
To:        dfdl-wg@ogf.org
Date:        16/10/2014 05:58
Subject:        Re: [DFDL-WG] do we allow indexing of non-array, non-optional
Sent by:        dfdl-wg-bounces@ogf.org




I don't think we should depart from the standard XPath rules any more than is necessary. Sometimes an XPath author will put [1] after every scalar element as a matter of habit, because it makes the execution of the expression faster ( in some XPath processors ).

regards,

Tim Kimber,
Technical Lead for IBM Integration Bus Healthcare Pack
Hursley, UK
Internet:  kimbert@uk.ibm.com
Tel. 01962-816742  
Internal tel. 37246742





From:        
Mike Beckerle <mbeckerle.dfdl@gmail.com>
To:        
"dfdl-wg@ogf.org" <dfdl-wg@ogf.org>
Date:        
15/10/2014 22:05
Subject:        
[DFDL-WG] do we allow indexing of non-array, non-optional
Sent by:        
dfdl-wg-bounces@ogf.org




I don't recall whether we decided this matter or not. I would search for it myself, but I tried and failed to find anything. This is a hard topic to do searching on... no good keywords.

If element 'e' has maxOccurs = 1, minOccurs = 1 (or neither are mentioned), is e[1] a valid expression? what about e[../some/pathExp/here]?

If element 'e' has minOccurs= 0 maxOccurs = 1, is e[1] a valid expression, or do you access an optional element just by ../e ?


Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology |
www.tresys.com
Please note: Contributions to the DFDL Workgroup's email discussions are subject to the
OGF Intellectual Property Policy
--
dfdl-wg mailing list
dfdl-wg@ogf.org
https://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
--
 dfdl-wg mailing list
 dfdl-wg@ogf.org
 
https://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

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