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 SupportXPath syntax in DFDL expression

Post new topicReply to topic Goto page Previous  1, 2
XPath syntax in DFDL expression View previous topic :: View next topic
Author Message
timber
PostPosted: Tue Jan 15, 2019 2:20 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1011

The structure of your schema is not the same as my proposal. The complex element with the dfdl:length={../lengthField-4} needs to come after the length field.
Back to top
View user's profile Send private message
petervh1
PostPosted: Tue Jan 15, 2019 10:20 pm Post subject: Reply with quote

Acolyte

Joined: 19 Apr 2010
Posts: 51

I've redone the structure according to what I think you recommended:

Code:

<xsd:element dfdl:initiator="" maxOccurs="unbounded" name="Type14">
    <xsd:complexType>
              <xsd:sequence dfdl:separator="">
        <xsd:element dfdl:initiator="14.001:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.LEN"
        dfdl:textNumberPattern="#0" type="xsd:nonNegativeInteger"/>
            <xsd:sequence>               
                <xsd:element dfdl:length="{../T14.LEN - 4}" dfdl:lengthKind="explicit" name="field1">
                  <xsd:complexType>
                    <xsd:sequence dfdl:separator="">
                      <xsd:element dfdl:initiator="14.002:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.IDC" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.003:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.IMP" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.004:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.SRC" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.005:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.TCD">
            <xsd:complexType>
                  <xsd:sequence dfdl:separator="" dfdl:terminator="">
                      <xsd:element dfdl:terminator="%#x1F;" name="T14.005.1" type="xsd:string"/>
                        <xsd:element name="T14.005.2" type="xsd:string"/>
                  </xsd:sequence>
            </xsd:complexType>               
        </xsd:element>
                      <xsd:element dfdl:initiator="14.006:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.HLL" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.007:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.VLL" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.008:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.SLC" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.009:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.HPS" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.010:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.VPS" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.011:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.GCA" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.012:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.BPX" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.013:" dfdl:terminator="%#x1D;" minOccurs="1" name="T14.FGP" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.020:" dfdl:terminator="%#x1D;" minOccurs="0" name="T14.COM" type="xsd:string"/>
                      <xsd:element dfdl:initiator="14.999:" dfdl:lengthKind="delimited" minOccurs="1"
                      name="T14.DAT" type="xsd:hexBinary"/>
                    </xsd:sequence>
                  </xsd:complexType>
                </xsd:element>
              </xsd:sequence>
            </xsd:sequence>
    </xsd:complexType>
    </xsd:element>



This does not save properly - it returns an error message:

Quote:

CTDV1524E : For a complex element, when 'lengthKind' is 'explicit' or 'prefixed', and 'lengthUnits' is characters, all simple child elements must have text representation, 'lengthUnits' set to 'characters' and the same encoding. Element: #xscd(/schemaElement::NIST_AUT_IN_V0.3/type::0/model::sequence/schemaElement::Type14/type::0/model::sequence/model::sequence/schemaElement::field1/type::0/model::sequence/schemaElement::T14.DAT).


If I change the type= for the binary field (T14.DAT) to string, the DFDL saves, but when I run a Test Parse I get:

Quote:

CTDP3011E: Character decoding error: The sequence of bytes starting at byte offest '463' is not a valid character in the encoding 'US-ASCII'
Back to top
View user's profile Send private message
timber
PostPosted: Wed Jan 16, 2019 1:29 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1011

Good - that's progress.
US-ASCII is a 7-bit encoding, so any byte with a value >127 will trigger that error. You should set the encoding on the binary field to 'ISO-8859-1' (as I recommended earlier in this thread).
Back to top
View user's profile Send private message
petervh1
PostPosted: Wed Jan 16, 2019 1:53 am Post subject: Reply with quote

Acolyte

Joined: 19 Apr 2010
Posts: 51

When I add dfdl:encoding=''ISO-8859-1" to the binary field I get the same CTDV1524E error as in my last post.

Quote:

<xsd:element dfdl:initiator="14.999:" dfdl:lengthKind="delimited" minOccurs="1" dfdl:encoding="ISO-8859-1" name="T14.DAT" type="xsd:hexBinary"/>
Back to top
View user's profile Send private message
petervh1
PostPosted: Wed Jan 16, 2019 2:13 am Post subject: Reply with quote

Acolyte

Joined: 19 Apr 2010
Posts: 51

I get the same result with type="xsd:string" and dfdl:encoding="ISO-8859-1"
Back to top
View user's profile Send private message
timber
PostPosted: Wed Jan 16, 2019 7:01 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1011

Please can you quote
- the full error message
- the byte value of the offending 'character' (should be able to work that out by using the offset quoted in the error message)
Back to top
View user's profile Send private message
petervh1
PostPosted: Wed Jan 16, 2019 9:54 pm Post subject: Reply with quote

Acolyte

Joined: 19 Apr 2010
Posts: 51

When I code the binary string as follows:
Code:

<xsd:element dfdl:initiator="14.999:" dfdl:lengthKind="delimited" minOccurs="1"
                      name="T14.DAT" type="xsd:string"/>


I get the following error during Test Parse:
Quote:

17 Jan 2019, 7:30:10 AM info: Offset: 456. Found initiator '14.999:' for 'T14.DAT'
[dfdl = /NIST_Test/NIST_AUT_IN_V0.3.xsd, scd = #xscd(/schemaElement::NIST_AUT_IN_V0.3/type::0/model::sequence/schemaElement::Type14/type::0/model::sequence/model::sequence/schemaElement::field1/type::0/model::sequence/schemaElement::T14.DAT), 60]

17 Jan 2019, 7:30:10 AM error: CTDP3011E: Character decoding error. The sequence of bytes starting at byte offset '463' is not a valid character in the encoding 'US-ASCII' .

17 Jan 2019, 7:30:10 AM fatal: CTDP3011E: Character decoding error. The sequence of bytes starting at byte offset '463' is not a valid character in the encoding 'US-ASCII' .


The data starting at offset 463 (which is indeed the first byte after the 14.999: initiator) is:
Quote:

C3BFC2A0C3BFC2A4203A0907200932C3
9326372009167EC2B5C3A8010906E280
94C3BEE2809D0109016BC3A9C3B92009
0241376820092EC3BF55C3B00109
Back to top
View user's profile Send private message
timber
PostPosted: Thu Jan 17, 2019 12:29 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1011

The answer is right there in the error message. The binary element is still using US-ASCII!
Try this:
Code:
<xsd:element dfdl:initiator="14.999:" dfdl:lengthKind="delimited" minOccurs="1" name="T14.DAT" type="xsd:string" dfdl:encoding="ISO-8859-1"/>
Back to top
View user's profile Send private message
petervh1
PostPosted: Thu Jan 17, 2019 1:14 am Post subject: Reply with quote

Acolyte

Joined: 19 Apr 2010
Posts: 51

When I code the binary element as per your last post, I get:

Quote:

CTDV1524E : For a complex element, when 'lengthKind' is 'explicit' or 'prefixed', and 'lengthUnits' is characters, all simple child elements must have text representation, 'lengthUnits' set to 'characters' and the same encoding. Element: #xscd(/schemaElement::NIST_AUT_IN_V0.3/type::0/model::sequence/schemaElement::Type14/type::0/model::sequence/model::sequence/schemaElement::field1/type::0/model::sequence/schemaElement


when I try to save the xsd file.
Back to top
View user's profile Send private message
timber
PostPosted: Thu Jan 17, 2019 3:26 pm Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1011

That's a pretty good error message. It tells you exactly what the problem is. I suggest that you use ISO-8859-1 throughout your schema - it is a superset of US-ASCII so the worst that can happen is that it tolerates some text that would otherwise have triggered a character decoding error.
Back to top
View user's profile Send private message
petervh1
PostPosted: Mon Jan 21, 2019 3:19 am Post subject: Reply with quote

Acolyte

Joined: 19 Apr 2010
Posts: 51

I've got the parsing working now.

Thanks again for all your assistance.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum IndexWebSphere Message Broker SupportXPath syntax in DFDL expression
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.