
It would certainly be valuable to throw an SDE as well as a PE. When unparsing there isn't much diffierence since both are fatal, but when parsing it's quite important. I suppose we could use the QName argument as a means of distinguishing these two types of error? ...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 <http://www.ogf.org/About/abt_policies.php> On Wed, Aug 3, 2016 at 5:34 AM, Steve Hanson <smh@uk.ibm.com> wrote:
Agreed that fn:error() looks suitable. Is the assumption that it always throws a PE, or do we want the ability to throw an SDE as well ?
I ask because section 23 maps all but one XPath error to SDE.
Regards
Steve Hanson *IBM Integration Bus* <http://www-03.ibm.com/software/products/en/ibm-integration-bus>, Hursley, UK Architect, *IBM DFDL* <http://www.ibm.com/developerworks/library/se-dfdl/index.html> Co-Chair, *OGF DFDL Working Group* <http://www.ogf.org/dfdl/> *smh@uk.ibm.com* <smh@uk.ibm.com> tel:+44-1962-815848 mob:+44-7717-378890
From: Mike Beckerle <mbeckerle.dfdl@gmail.com> To: Steve Hanson/UK/IBM@IBMGB Cc: "dfdl-wg@ogf.org" <dfdl-wg@ogf.org> Date: 06/07/2016 14:02 Subject: Re: [DFDL-WG] still no need for fn:error - re-assess ------------------------------
I recall now that QName is a subtype of string, so it's just a kind of string.
So I agree. I guess fn:error can be used as per XPath without modification.
Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | *www.tresys.com* <http://www.tresys.com/> Please note: Contributions to the DFDL Workgroup's email discussions are subject to the *OGF Intellectual Property Policy* <http://www.ogf.org/About/abt_policies.php>
On Wed, Jul 6, 2016 at 5:32 AM, Steve Hanson <*smh@uk.ibm.com* <smh@uk.ibm.com>> wrote: Mike
True that xs:QName is not a type that is supported as the simple type of an element, but we do use QNames elsewhere in DFDL schema, eg, in element refs, type references, as the type of some DFDL properties (eg, dfdl:ref, dfdl:hiddenGroupRef, dfdl:prefixLengthType), to reference variables in expressions, ... So I don't see a problem with having a function argument being a QName.
Regards
Steve Hanson *IBM Integration Bus* <http://www-03.ibm.com/software/products/en/ibm-integration-bus>, Hursley, UK Architect, *IBM DFDL* <http://www.ibm.com/developerworks/library/se-dfdl/index.html> Co-Chair, *OGF DFDL Working Group* <http://www.ogf.org/dfdl/> *smh@uk.ibm.com* <smh@uk.ibm.com> tel:*+44-1962-815848* <%2B44-1962-815848> mob:*+44-7717-378890* <%2B44-7717-378890>
From: Mike Beckerle <*mbeckerle.dfdl@gmail.com* <mbeckerle.dfdl@gmail.com>> To: Steve Hanson/UK/IBM@IBMGB Cc: "*dfdl-wg@ogf.org* <dfdl-wg@ogf.org>" <*dfdl-wg@ogf.org* <dfdl-wg@ogf.org>> Date: 05/07/2016 19:08 Subject: Re: [DFDL-WG] still no need for fn:error - re-assess ------------------------------
So the fn:error() XPath function takes a problematic argument.
All the arguments are optional, so fn:error() is legal.
The first argument is of type xs:qQName, and we don't have that type in DFDL. So the best we could do is to accept a string that is in the "form" of a QName, e.g., "foo:bar".
The second argument is a description string, third and subsequent args are objects. The manner by which this string and objects are provided to the execution environment is implementation dependent according to the XQuery and XPath spec, and this is fine for DFDL implementations also.
The lack of the QName type for the first argument suggests we're going to need to create dfdl:error(string, string, item()*), where the first argument is a string in the form of a QName, and the other arguments are as per fn:error.
Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | *www.tresys.com* <http://www.tresys.com/> Please note: Contributions to the DFDL Workgroup's email discussions are subject to the *OGF Intellectual Property Policy* <http://www.ogf.org/About/abt_policies.php>
On Tue, Jul 5, 2016 at 11:49 AM, Steve Hanson <*smh@uk.ibm.com* <smh@uk.ibm.com>> wrote: WG agreed that an error function is needed, action 288 raised.
*No* *Action *
*288* *Decide on error function specification (Mike)* 5/7: An error function is useful for expressions when unparsing. Mike to evaluate XPath fn:error().
Regards
Steve Hanson *IBM Integration Bus* <http://www-03.ibm.com/software/products/en/ibm-integration-bus>, Hursley, UK Architect, *IBM DFDL* <http://www.ibm.com/developerworks/library/se-dfdl/index.html> Co-Chair, *OGF DFDL Working Group* <http://www.ogf.org/dfdl/> *smh@uk.ibm.com* <smh@uk.ibm.com> tel:*+44-1962-815848* <%2B44-1962-815848> mob:*+44-7717-378890* <%2B44-7717-378890>
From: Mike Beckerle <*mbeckerle.dfdl@gmail.com* <mbeckerle.dfdl@gmail.com>> To: "*dfdl-wg@ogf.org* <dfdl-wg@ogf.org>" <*dfdl-wg@ogf.org* <dfdl-wg@ogf.org>> Date: 14/06/2016 17:10 Subject: Re: [DFDL-WG] still no need for fn:error Sent by: "dfdl-wg" <*dfdl-wg-bounces@ogf.org* <dfdl-wg-bounces@ogf.org>> ------------------------------
I want to re-open the discussion of fn:error.
Previously we said it was not needed because an assert could be used.
However, we've now run into where we want to cause an error, during unparsing, during outputValueCalc.
<xs:element name="Protocol" type="pcap:bit" dfdl:length="8" dfdl:outputValueCalc="{ if (fn:exists(../../pcap:ICMPv4)) then 1 else if (fn:exists(../../pcap:TransportLayer/pcap:TCP )) then 6 else if (fn:exists(../../pcap:TransportLayer/pcap:UDP )) then 17 else -1 }"/>
That -1 at the end. That's an error case. We really want fn:error("Unrecognized protocol.")
We can't change to a dfdl:assert, because assertions aren't evaluated when unparsing.
Comments?
Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | *www.tresys.com* <http://www.tresys.com/> Please note: Contributions to the DFDL Workgroup's email discussions are subject to the *OGF Intellectual Property Policy* <http://www.ogf.org/About/abt_policies.php>
On Thu, Jul 25, 2013 at 9:16 AM, Mike Beckerle <*mbeckerle.dfdl@gmail.com* <mbeckerle.dfdl@gmail.com>> wrote: Respin of this example:
Here's the example as suggested by Jonathan of how to issue an error that I previously was suggesting needed fn:error. I'm convinced this is sufficient and we can avoid the need for fn:error now.
<xs:element name="magic_number" type="ex:uint32" dfdl:byteOrder="bigEndian"> <xs:annotation> <xs:appinfo source="*http://www.ogf.org/dfdl/* <http://www.ogf.org/dfdl/dfdl-1.0/>"> <dfdl:assert test="{ (xs:unsignedInt(.) eq *dfdl:unsignedInt('xa1b2c3d4')*) | (xs:unsignedInt(.) eq *dfdl:unsignedInt('xd4c3b2a1')*) }" message="{ fn:concat( 'Magic number ', dfdl:hexBinary(dfdl:unsignedInt(.)), ' was not 0xA1B2C3D4 (for bigEndian) or 0xD4C3B2A1 (for littleEndian).' }" /> <dfdl:setVariable ref="ex:bOrd">{ xs:unsignedInt(.) }<dfdl:setVariable> </xs:appinfo> </xs:annotation> </xs:element>
On Wed, Jul 24, 2013 at 11:58 AM, Steve Hanson <*smh@uk.ibm.com* <smh@uk.ibm.com>> wrote: Mike, I think you meant:
test="{ (xs:unsignedInt(.) eq *dfdl:unsignedInt('xa1b2c3d4')*) | (xs:unsignedInt(.) eq *dfdl:unsignedInt('xd4c3b2a1')*) }"
Regards
Steve Hanson Architect, IBM Data Format Description Language (DFDL) Co-Chair, *OGF DFDL Working Group* <http://www.ogf.org/dfdl/> IBM SWG, Hursley, UK *smh@uk.ibm.com* <smh@uk.ibm.com> tel:*+44-1962-815848* <%2B44-1962-815848>
From: Mike Beckerle <*mbeckerle.dfdl@gmail.com* <mbeckerle.dfdl@gmail.com>> To: *dfdl-wg@ogf.org* <dfdl-wg@ogf.org>, Date: 24/07/2013 16:46 Subject: [DFDL-WG] still no need for fn:error Sent by: *dfdl-wg-bounces@ogf.org* <dfdl-wg-bounces@ogf.org> ------------------------------
Here's the example as suggested by Jonathan of how to issue an error that I previously was suggesting needed fn:error. I'm convinced this is sufficient and we can avoid the need for fn:error now.
<xs:element name="magic_number" type="ex:uint32" dfdl:byteOrder="bigEndian"> <xs:annotation> <xs:appinfo source="*http://www.ogf.org/dfdl/* <http://www.ogf.org/dfdl/dfdl-1.0/>"> <dfdl:assert test="{ (xs:unsignedInt(.) eq *dfdl:unsignedInt('xa1b2c3d4')*) | (xs:unsignedInt(.) eq *dfdl:unsignedInt('xd4c3b2a1')*) }" message="{ fn:concat( 'Magic number ', dfdl:hexBinary(dfdl:unsignedInt(.)), ' was not 0xA1B2C3D4 (for bigEndian) or 0xD4C3B2A1 (for littleEndian).' }" /> <dfdl:setVariable ref="ex:bOrd">{ xs:unsignedInt(.) }<dfdl:setVariable> </xs:appinfo> </xs:annotation> </xs:element>
-- Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | *www.tresys.com* <http://www.tresys.com/> -- dfdl-wg mailing list *dfdl-wg@ogf.org* <dfdl-wg@ogf.org> *https://www.ogf.org/mailman/listinfo/dfdl-wg* <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
-- Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | *www.tresys.com* <http://www.tresys.com/>
-- dfdl-wg mailing list *dfdl-wg@ogf.org* <dfdl-wg@ogf.org> *https://www.ogf.org/mailman/listinfo/dfdl-wg* <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
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
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