flatpack
                                
                                
                                
                                    flatpack copied to clipboard
                            
                            
                            
                        Fixed length with arrays?
I have a situation where I'd like to parse a flat file without linebreaks that also contains "sub" arrays. Is there a way to specify that as a parser definition? (I may not have the right syntax for your PZMAP) For example, if I had a definition like this:
<record name="owner">
    <column  length="5"/>
    <record name="pet" length="5" repeat="3" />
</record>
And a dataset like this (represents 2 records of 20 characters, pipes added for visibility):
|AliceTiny Fluff     Bob  Zap  Frog Wooly|
Would create:
<owner name="Alice">
    <pet>Tiny</pet>
    <pet>Fluff</pet>
</owner>
<owner name="Bob">
    <pet>Zap</pet>
    <pet>Frog</pet>
    <pet>Wooly</pet>
</owner>
                                    
                                    
                                    
                                
Hi
I do not know if it is possible but I'd assume not.
A workaround would be to define pet1,pet2 and pet3 in the XML definition and then call those.
Also you could define a Pets subsection with a discriminator. A common type of record could be embedded / different, eg if a record starts with 'X' then the format should be a record X; if it starts with 'Y' then follow the Y record.
I hope this helps
Feel free to submit a patch or pull request if you want to develop this 'repeat' mechanism but I'm not too sure how the getString('xxx') would work and it has to work with CSV and other delimited formats too.
Benoit
Important Notice This communication contains information that is considered confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender and delete the original
On 8 Aug 2016, at 17:15, Oblio [email protected] wrote:
I have a situation where I'd like to parse a flat file without linebreaks that also contains "sub" arrays. Is there a way to specify that as a parser definition? (I may not have the right syntax for your PZMAP) For example, if I had a definition like this:
And a dataset like this (represents 2 records of 20 characters, pipes added for visibility): |AliceTiny Fluff Bob Zap Frog Wooly| Would create:
Tiny Fluff — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread. Zap Frog Wooly