[DFDL-WG] Can I concatenate a variable?

Garriss Jr., James P. jgarriss at mitre.org
Tue Jun 25 10:19:39 EDT 2013


> I think you need more flexibility than that

Correct.  The boundary string for multipart emails is an infinite set of possibilities.

> The dfdl:initiator/separator/terminator properties do take a DFDL expression, and it should be possible to model a wide range of data formats using those properties

Maybe.  I've already considered this, and it may be possible to rebuild the DFDL schema using one of these.

For what I'm doing, however, I think this is another one of those cases where it's simply going to be easier to do this Java.

Thanks for thinking through this, Tim.

From: dfdl-wg-bounces at ogf.org [mailto:dfdl-wg-bounces at ogf.org] On Behalf Of Tim Kimber
Sent: Tuesday, June 25, 2013 9:56 AM
To: dfdl-wg at ogf.org
Subject: Re: [DFDL-WG] Can I concatenate a variable?

There is no way to vary the pattern depending on the value of a variable unless you have a limited number of possible patterns.  In that case you could use the variable ( in the expression for a DFDL discriminator ) to discriminate a choice where each branch of the choice has a different DFDL regular expression.

However, I think you need more flexibility than that - the boundary string could be just about anything, right?. The dfdl:initiator/separator/terminator properties do take a DFDL expression, and it should be possible to model a wide range of data formats using those properties. Is there some reason why that is not possible in your case?

regards,

Tim Kimber, DFDL Team,
Hursley, UK
Internet:  kimbert at uk.ibm.com<mailto:kimbert at uk.ibm.com>
Tel. 01962-816742
Internal tel. 37246742




From:        "Garriss Jr., James P." <jgarriss at mitre.org<mailto:jgarriss at mitre.org>>
To:        "dfdl-wg at ogf.org<mailto:dfdl-wg at ogf.org>" <dfdl-wg at ogf.org<mailto:dfdl-wg at ogf.org>>,
Date:        25/06/2013 12:38
Subject:        Re: [DFDL-WG] Can I concatenate a variable?
Sent by:        dfdl-wg-bounces at ogf.org<mailto:dfdl-wg-bounces at ogf.org>
________________________________



> In section 12.3.5 of the specification, the 'lengthPattern' property is listed as having the type 'DFDL Regular expression'. Unlike some other properties, dfdl:lengthPattern cannot be a DFDL expression. Therefore it cannot contain a DFDL variable reference.

Is there no workaround for this?

From: dfdl-wg-bounces at ogf.org<mailto:dfdl-wg-bounces at ogf.org> [mailto:dfdl-wg-bounces at ogf.org] On Behalf Of Tim Kimber
Sent: Monday, June 24, 2013 4:11 PM
To: dfdl-wg at ogf.org<mailto:dfdl-wg at ogf.org>
Subject: Re: [DFDL-WG] Can I concatenate a variable?

Hi James,

In section 12.3.5 of the specification, the 'lengthPattern' property is listed as having the type 'DFDL Regular expression'. Unlike some other properties, dfdl:lengthPattern cannot be a DFDL expression. Therefore it cannot contain a DFDL variable reference.

On the other hand, section 14.2 lists the data type of dfdl:separator as 'List of DFDL String Literals or DFDL Expression', However, your dfdl:separator is not a valid DFDL expression. The property must be either a valid DFDL expression or a list of DFDL string literals. The syntax you need is

<xsd:sequence dfdl:separator="{fn:concat('--'),$some_boundary}" dfdl:separatorSuppressionPolicy="anyEmpty"  dfdl:terminator="--%CR;%LF;">

regards,

Tim Kimber, DFDL Team,
Hursley, UK
Internet:  kimbert at uk.ibm.com<mailto:kimbert at uk.ibm.com>
Tel. 01962-816742
Internal tel. 37246742




From:        "Garriss Jr., James P." <jgarriss at mitre.org<mailto:jgarriss at mitre.org>>
To:        "dfdl-wg at ogf.org<mailto:dfdl-wg at ogf.org>" <dfdl-wg at ogf.org<mailto:dfdl-wg at ogf.org>>,
Date:        24/06/2013 20:38
Subject:        [DFDL-WG] Can I concatenate a variable?
Sent by:        dfdl-wg-bounces at ogf.org<mailto:dfdl-wg-bounces at ogf.org>
________________________________




Suppose I define a variable like this:

<dfdl:defineVariable name="boundary" defaultValue="some_boundary" type="xsd:string"/>

Can I later concatenate it with other values?

For example, can I concatenate it as part of a pattern?

<xsd:element name="Preamble" type="xsd:string" dfdl:lengthKind="pattern" dfdl:lengthPattern="(.+?)(?=--{$some_boundary})"/>

Can I concatenate it as part of a separator?

<xsd:sequence dfdl:separator="--{$some_boundary}" dfdl:separatorSuppressionPolicy="anyEmpty"  dfdl:terminator="--%CR;%LF;">

TIA!--
dfdl-wg mailing list
dfdl-wg at ogf.org<mailto:dfdl-wg at 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 at ogf.org<mailto:dfdl-wg at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20130625/4e5753c3/attachment-0001.html>


More information about the dfdl-wg mailing list