You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@daffodil.apache.org by "Costello, Roger L." <co...@mitre.org> on 2019/11/23 14:07:50 UTC

What is the scope of a property specified on an XML Schema item (element declaration, xs:sequence, etc.)?

Hi Folks,

Today, I learned that in the below snippet, the dfdl:encoding assigned on the <csv> element only applies to the <csv> element, not to its children.

<xs:element name="csv" dfdl:encoding="{$fieldencoding}">

What is the general rule? Is it: Any property assigned on an element declaration applies only to the element and not to its children? But, but, but, ... a dfdl:separator property assigned on a <xs:sequence> element applies to the children of xs:sequence. Wow, this is confusing. Sometimes the properties assigned on an XML Schema item is inherited by the item's children, sometimes not. Isn't that confusing?

/Roger

Re: What is the scope of a property specified on an XML Schema item (element declaration, xs:sequence, etc.)?

Posted by "Beckerle, Mike" <mb...@tresys.com>.
I will say that I lobbied hard for lexical scoping of properties in DFDL, where some properties would flow-down to the contained children of a enclosing parent object lexically.

The challenge here was that this is natural for some properties (byteOrder, encoding), and unnatural for others (delimiters, lengthKind, inputValueCalc), and so the compromise was made to make all properties local to what they are decorated onto, with lexical scoping only based on the surrounding default format expressed at the file level.

This scheme is workable, and avoids the need to specify, for every property, in what contexts it is inherited by enclosed children, and what contexts it is not.





________________________________
From: Sloane, Brandon <bs...@tresys.com>
Sent: Saturday, November 23, 2019 6:05 PM
To: users@daffodil.apache.org <us...@daffodil.apache.org>
Subject: Re: What is the scope of a property specified on an XML Schema item (element declaration, xs:sequence, etc.)?

This was probably one of the most confusing aspects of DFDL for me as well. The only scoping of attribute's is that a schema file's format annotation applies as the default format for any type in said file.

What goes on with deliminators is slightly different. When you define a dfdl:seperator on an xs:sequence, that property is not actually inherited by any of the elements, but is just a property of the sequence itself. To see this, consider nested sequences. If the outer sequence defines a seperator of ",", and the inner sequence does not, then a "," encountered while parsing the inner sequence will not seperate elements of the inner sequence. It may, however, terminate the inner sequence to seperate elements of the outer sequence.

There is certainly something scopey going on here, but it is not elements inheriting attribures from parents.

Brandon T. Sloane
Associate, Services
bsloane@tresys.com | tresys.com
________________________________
From: Costello, Roger L. <co...@mitre.org>
Sent: Saturday, November 23, 2019 9:07:50 AM
To: users@daffodil.apache.org <us...@daffodil.apache.org>
Subject: What is the scope of a property specified on an XML Schema item (element declaration, xs:sequence, etc.)?


Hi Folks,



Today, I learned that in the below snippet, the dfdl:encoding assigned on the <csv> element only applies to the <csv> element, not to its children.



<xs:element name="csv" dfdl:encoding="{$fieldencoding}">



What is the general rule? Is it: Any property assigned on an element declaration applies only to the element and not to its children? But, but, but, … a dfdl:separator property assigned on a <xs:sequence> element applies to the children of xs:sequence. Wow, this is confusing. Sometimes the properties assigned on an XML Schema item is inherited by the item’s children, sometimes not. Isn’t that confusing?



/Roger

Re: What is the scope of a property specified on an XML Schema item (element declaration, xs:sequence, etc.)?

Posted by "Sloane, Brandon" <bs...@tresys.com>.
This was probably one of the most confusing aspects of DFDL for me as well. The only scoping of attribute's is that a schema file's format annotation applies as the default format for any type in said file.

What goes on with deliminators is slightly different. When you define a dfdl:seperator on an xs:sequence, that property is not actually inherited by any of the elements, but is just a property of the sequence itself. To see this, consider nested sequences. If the outer sequence defines a seperator of ",", and the inner sequence does not, then a "," encountered while parsing the inner sequence will not seperate elements of the inner sequence. It may, however, terminate the inner sequence to seperate elements of the outer sequence.

There is certainly something scopey going on here, but it is not elements inheriting attribures from parents.

Brandon T. Sloane
Associate, Services
bsloane@tresys.com | tresys.com
________________________________
From: Costello, Roger L. <co...@mitre.org>
Sent: Saturday, November 23, 2019 9:07:50 AM
To: users@daffodil.apache.org <us...@daffodil.apache.org>
Subject: What is the scope of a property specified on an XML Schema item (element declaration, xs:sequence, etc.)?


Hi Folks,



Today, I learned that in the below snippet, the dfdl:encoding assigned on the <csv> element only applies to the <csv> element, not to its children.



<xs:element name="csv" dfdl:encoding="{$fieldencoding}">



What is the general rule? Is it: Any property assigned on an element declaration applies only to the element and not to its children? But, but, but, … a dfdl:separator property assigned on a <xs:sequence> element applies to the children of xs:sequence. Wow, this is confusing. Sometimes the properties assigned on an XML Schema item is inherited by the item’s children, sometimes not. Isn’t that confusing?



/Roger