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 Index » WebSphere Message Broker (ACE) Support » Use a XSD Complex Type in a DFDL Schema

Post new topic  Reply to topic
 Use a XSD Complex Type in a DFDL Schema « View previous topic :: View next topic » 
Author Message
digoshc
PostPosted: Sun Nov 10, 2013 3:21 am    Post subject: Use a XSD Complex Type in a DFDL Schema Reply with quote

Apprentice

Joined: 11 Jul 2013
Posts: 25

Hi,

I'm defining a DFDL Schema for the first time in WMB Toolkit 8.0.0.2. I need to parse a MIME Body (BLOB) to a DFDL Schema, based on a recorded-oriented text. Basically, the email body will came as a text with delimited fields, for example:

Code:

   From: x@x.com
       To: y@y.com
Subject: ABC
   Body:

WMB,8.0.0.2,Windows,DB2



The record has the following fields:

ESB: WMB
Version: 8.0.0.2
SO: Windows
DB: DB2

So, I'm creating a DFDL schema to describe my record. The value WMB is a complex type defined in my canonical model in pure XSD file. The problem is that I'm not able to use my canonical model in the DFDL Schema Editor in Toolkit to specify the types of the elements. If I force specifying the types using a text editor, I got this error:

CTDS1086E : Included or imported schema not a DFDL schema. 'platform:/resource/Canonical/Common/CommonsV1.xsd'.

My questions are: Is it possible to use a pure XSD file to specify the type of a element in a DFDL schema? or Should I convert my XSD to a DFDL?

DFDL Schema:
Code:

<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xy="http://www.gru.com.br/CM/Common/V1"
xmlns:ibmDfdlExtn="http://www.ibm.com/dfdl/extensions" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions"
xmlns:recSepFieldsFmt="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:import namespace="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat" schemaLocation="IBMdefined/RecordSeparatedFieldFormat.xsd"/>
    <xsd:import namespace="http://www.xxxxx.com/CM/Common/V1" schemaLocation="../Canonical/Common/CommonsV1.xsd"/>
   
    <xsd:annotation>
      <xsd:appinfo source="http://www.ogf.org/dfdl/">
         <dfdl:format byteOrder="{$dfdl:byteOrder}" encoding="{$dfdl:encoding}" escapeSchemeRef="recSepFieldsFmt:RecordEscapeScheme" occursCountKind="fixed" ref="recSepFieldsFmt:RecordSeparatedFieldsFormat"/>
      </xsd:appinfo>
   </xsd:annotation>

   <xsd:element ibmSchExtn:docRoot="true" name="XXXXXXX">
      <xsd:complexType>
         <xsd:sequence dfdl:separator="%CR;%LF;%WSP*;">
            <xsd:element dfdl:occursCountKind="implicit" maxOccurs="unbounded" name="body">
               <xsd:complexType>
                  <xsd:sequence dfdl:separator="%#44;" dfdl:separatorPolicy="suppressedAtEndLax">
                     <xsd:element ibmDfdlExtn:sampleValue="body_value1" name="ESB" type="xy:ESBType"/>
                            <xsd:element ibmDfdlExtn:sampleValue="body_value2" name="Version" type="xsd:string"/>
                     <xsd:element ibmDfdlExtn:sampleValue="body_value3" name="SO" type="xsd:string"/>
                            <xsd:element ibmDfdlExtn:sampleValue="body_value4" name="DB" type="xsd:string"/>
                        </xsd:sequence>
               </xsd:complexType>
            </xsd:element>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>

</xsd:schema>


Canonical XSD - CommonsV1.xsd:
Code:

   <xsd:complexType name="ESBType">
      <xsd:annotation>
         <xsd:documentation>esb type
         </xsd:documentation>
      </xsd:annotation>
      <xsd:simpleContent>
         <xsd:extension base="tns:xxx">
            <xsd:attribute name="xxx" type="tns:CodeContextType"
               use="required">
               <xsd:annotation>
                  <xsd:documentation></xsd:documentation>
               </xsd:annotation>
            </xsd:attribute>
         </xsd:extension>
      </xsd:simpleContent>
   </xsd:complexType>
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Nov 10, 2013 5:30 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

DFDL uses an 'xsd' file to hold the message model. Because you are not modelling an XML structure I can't see how you can use a pure xml orientated XSD to define it. the DFDL model has to deal with a whole lot of 'stuff' that XML never knows about less even cares about.

Ask yourself this question.

How do I define things like field delimiter and record terminations in a pure XML oriented XSD?
AFAIK, you can't.
Perhaps this is where you have become slightly confused?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Nov 10, 2013 5:39 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I've read this three or four times, and I'm still not clear what's trying to be done.

digoshc - what are you trying to get the DFDL parser to do? Parse MIME? Use part of an existing XSD to model data? Create an XML representation of DFDL data?

It doesn't do any of those, not really.
Back to top
View user's profile Send private message
digoshc
PostPosted: Sun Nov 10, 2013 6:42 am    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2013
Posts: 25

smdavies99 wrote:

How do I define things like field delimiter and record terminations in a pure XML oriented XSD?


digoshc wrote:

Good question, made me think about it. I was probably unclear on my question. Let me try again. I'm not trying to create a pure XSD file to define things like field delimiter and record termination. I understand that DFDL was specified to provide these capabilities that pure XSD doesn't. That said, let me explain my problem again:

My message flow is the following:

EmailInputNode -> ComputeNode (transform the email body) -> MQOutputNode

Since the inbound email is parsed by the MIME parser and the email Body comes as a BLOB to the ComputeNode, I need to parse the BLOB bitstream to a human readable message tree, that's why I'm defining a DFDL schema to manipulate the record that comes in the email body: "WMB,8.0.0.2,Windows,DB2"

The type of the elements in this record can be simple or complex types. When it's a simple type, I don't have any problem to define it in the DFDL Schema Editor, however, when I want to reuse a complex type defined in a pure XSD file, I can't.

Code:

// this fragment is in the DFDL schema file
<xsd:element ibmDfdlExtn:sampleValue="body_value1" name="ESB" type="xy:ESBType"/>


The Complex Type: "xy:ESBType" is defined in a pure XSD file:

Code:

// this fragment is in a pure XSD file
<xsd:complexType name="ESBType">


So, I'm not trying to define the fields delimiters and record termination in the pure XSD file, I'm only trying to reuse the complex type "ESBType" in a element type of a DFDL schema. However, WMB toolkit doesn't allow it, neither by the DFDL Schema Editor or pure XSD editor.

So, maybe I'm trying to do the wrong thing, but naturally, I thought that I could import a XSD file in a DFDL schema and reuse a complex type. Is that the point I'm failing?


Last edited by digoshc on Tue Nov 12, 2013 3:07 am; edited 2 times in total
Back to top
View user's profile Send private message
digoshc
PostPosted: Sun Nov 10, 2013 6:48 am    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2013
Posts: 25

mqjeff wrote:

digoshc - what are you trying to get the DFDL parser to do? Parse MIME? Use part of an existing XSD to model data? Create an XML representation of DFDL data?


digoshc wrote:

what are you trying to get the DFDL parser to do?
I'm trying to parse email body (BLOB) to a DFDL Schema.

Parse MIME?
Actually not entire MIME, only the Body Part.

Use part of an existing XSD to model data?
Yes, that's the point. I want to reuse a existing XSD complex type in a DFDL schema.

Create an XML representation of DFDL data?
Yes, I need to serialize DFDL data to a XML file and send it to a outbound message queue.

Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Nov 10, 2013 7:47 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Ok.

DFDL does use XSD as it's base model, so you could use an include or an import to add in the type.

But you still then have to go in and configure all of the DFDL specific properties, using the DFDL editor.

And there's nothing you can do to tell IIB that "This tree under the DFDL parser should be serialized as an XML tree".

You have to use normal broker transformation methods to convert the DFDL logical tree to an XMLNSC logical tree.

To get the body of a MIME part turned into a DFDL tree, just use CREATE FIELD.
Back to top
View user's profile Send private message
digoshc
PostPosted: Mon Nov 11, 2013 2:50 am    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2013
Posts: 25

OK, thank you. I'm importing the XSD in the DFDL schema, still having the error CTDS1086E : Included or imported schema not a DFDL schema. 'platform:/resource/Canonical/Common/CommonsV1.xsd', but I'm going to review the import.

Last edited by digoshc on Mon Nov 11, 2013 5:08 am; edited 1 time in total
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Nov 11, 2013 4:00 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

digoshc: I understand what you are trying to achieve, and I think it should be possible - let me check and get back to you.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Nov 11, 2013 8:17 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I know what the problem is.
DFDL supports a limited subset of XSD - just enough to represent non-XML data. Your complex type contains an attribute, and DFDL 1.0 does not support attributes.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
digoshc
PostPosted: Mon Nov 11, 2013 3:13 pm    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2013
Posts: 25

I appreciated that, thank you, Kimbert.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Use a XSD Complex Type in a DFDL Schema
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.