ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere Message Broker SupportDFDL modeling elements with unknown names

Post new topicReply to topic
DFDL modeling elements with unknown names View previous topic :: View next topic
Author Message
rekarm01
PostPosted: Fri Apr 13, 2018 5:38 pm Post subject: DFDL modeling elements with unknown names Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1299

Given a (simplified) sample message like:

Code:
Prop1=Val1
Prop2=Val2
Prop3=Val3
...

To preserve backwards compatibility with existing usage, I want the parsed tree structure to look something like:

Code:
<Prop1>Val1</Prop1>
<Prop2>Val2</Prop2>
<Prop3>Val3</Prop3>
...

except that the names of the elements aren't necessarily known in advance, so I can't enumerate them in the DFDL schema. I tried using regular expressions with dfdl:lengthPattern, something like:

Code:
<xsd:element dfdl:lengthKind="pattern" dfdl:lengthPattern="[A-Z][A-Za-z0-9]+" name="???" ... >

but that seems more useful for setting the value of an element, rather than the name. I also tried using dfdl:initiator to set the value for a dfdl variable, something like:

Code:
<xsd:element dfdl:initiator="[A-Z][A-Za-z0-9]+" name="{$elemName}" ... >

but couldn't quite figure out how to both set and use a dfdl variable within the scope of the same element.

How can DFDL model elements like this, where the names of the elements are provided in the data?
Back to top
View user's profile Send private message
timber
PostPosted: Sat Apr 14, 2018 2:55 am Post subject: Reply with quote

Sentinel

Joined: 25 Aug 2015
Posts: 838

One of the rules of DFDL is that the element names must be known in advance. Supporting XML Schema wildcards (xs:any, abstract types etc) would have been extremely difficult to specify properly, and would be used very rarely.

I would model your format like this:
Code:
message
  sequence delimiter=%NL;
    field maxOccurs=unbounded
      sequence delimiter='='
        fieldName
        fieldValue

Not exactly the XML structure that you were aiming for, but it would be simple to restructure the message tree if that matters.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Sat Apr 14, 2018 11:28 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1299

timber wrote:
One of the rules of DFDL is that the element names must be known in advance.

I suspected that, but I wasn't sure.

timber wrote:
I would model your format like this ... Not exactly the XML structure that you were aiming for, ...

Not exactly, no, but it seems like the best available option. Thanks for your help.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportDFDL modeling elements with unknown names
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.