|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
DFDL Xpath Expression |
« View previous topic :: View next topic » |
Author |
Message
|
chaitanyauk |
Posted: Sun May 28, 2017 9:42 pm Post subject: DFDL Xpath Expression |
|
|
Apprentice
Joined: 16 Apr 2017 Posts: 30
|
Hi Experts,
I have a DFDL Sample which I read from a file.
ID1,abc,111,201702,xyz
ID2,abcd,111,201703
ID3,abcde,222,201904,xyzz,abcc
ID4,aaa,222,201804
Here is my DFDL schema:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:csv="http://www.ibm.com/dfdl/CommaSeparatedFormat" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ibmDfdlExtn="http://www.ibm.com/dfdl/extensions" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions">
<xsd:import namespace="http://www.ibm.com/dfdl/CommaSeparatedFormat" schemaLocation="IBMdefined/CommaSeparatedFormat.xsd" />
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format documentFinalTerminatorCanBeMissing="yes" encoding="{$dfdl:encoding}" escapeSchemeRef="csv:CSVEscapeScheme" ref="csv:CommaSeparatedFormat" />
</xsd:appinfo>
</xsd:annotation>
<xsd:element ibmSchExtn:docRoot="true" name="TRecords">
<xsd:complexType>
<xsd:sequence dfdl:separator="">
<xsd:element dfdl:occursCountKind="implicit" dfdl:terminator="%NL;%WSP*;" maxOccurs="unbounded" minOccurs="0" name="record">
<xsd:complexType>
<xsd:sequence dfdl:separatorSuppressionPolicy="trailingEmpty">
<xsd:element ibmDfdlExtn:sampleValue="value1" maxOccurs="unbounded" name="c1" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema |
I need to split the record based on the number(3rd field).I need to group the records which has same number(3rd field).For example in my case,
all the record containing 111 as one message and 222 as another message.
I get 70000 records of these kind.
Can I use DFDL Xpath expression to split the record?
Can I use Initiator and terminator for this?
Please help! |
|
Back to top |
|
 |
timber |
Posted: Mon May 29, 2017 12:47 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
You *could* use a DFDL discriminator to do this, but I think you will probalby find it simpler to do this:
- Read the input file one line at a time using Parsed Record Sequence
- Maintain a SHARED variable that holds the value of the 3rd field. It has to be a SHARED variable because every record will be propagated from the FileInput node as a separate message.
- Whenever the variable value changes, close the current output file and start a new output file.
- When the end of the file is reached, reset the variable value. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|