Author |
Message
|
gagan.maverick |
Posted: Thu Jan 08, 2015 11:41 pm Post subject: XML AND ATTACH PDF |
|
|
Acolyte
Joined: 30 Sep 2014 Posts: 50
|
Hi guys , i have a requirement that after unzipping the the zip file in JCN i have to split the xml file into the number of INVOICES in it . and then i have to attach each invoice xml wit the pdf file in the incoming zip file , with the reference it has in its tag <imagename>. Any suggestions on how to proceed.
The sturcture of the zip file is
123.xml
abc.pdf
dcf.pdf
kjh.pdf
and these names are given as references inside the xml file like
<Invoices>
<Invoice>
<imagename>abc.pdf<imagename> |
|
Back to top |
|
 |
gagan.maverick |
Posted: Thu Jan 08, 2015 11:42 pm Post subject: |
|
|
Acolyte
Joined: 30 Sep 2014 Posts: 50
|
So, basically my output zip file will contain a splitted xml invoice and its referenced pdf file |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jan 09, 2015 5:31 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So you have to create more than one output file.
Each output file has to have a single document, of different types. Some of them are XML and some of them are PDF. |
|
Back to top |
|
 |
gagan.maverick |
Posted: Mon Jan 12, 2015 1:54 am Post subject: |
|
|
Acolyte
Joined: 30 Sep 2014 Posts: 50
|
Yes i need to create more than 1 output zip file , each with one invoice from the XML INVOICE, along with the pdf files which each invoice has a reference to |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jan 12, 2015 5:55 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
gagan.maverick wrote: |
Yes i need to create more than 1 output zip file , each with one invoice from the XML INVOICE, along with the pdf files which each invoice has a reference to |
So you need to construct more than one output message, each of which has the necessary contents. This output message is then sent to something that creates the actual files and then creates the necessary zip file of those files. |
|
Back to top |
|
 |
gagan.maverick |
Posted: Wed Feb 04, 2015 12:49 am Post subject: |
|
|
Acolyte
Joined: 30 Sep 2014 Posts: 50
|
Yes .. some xml tags .. its referenced pdf files |
|
Back to top |
|
 |
Vitor |
Posted: Wed Feb 04, 2015 5:37 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
gagan.maverick wrote: |
Yes .. some xml tags .. its referenced pdf files |
So what's the problem? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
VishnuPrasadS |
Posted: Thu Feb 05, 2015 2:14 am Post subject: |
|
|
Apprentice
Joined: 22 Feb 2013 Posts: 28 Location: Pune, India
|
Hi
I have assumed that you would
1. get zip file in some folder.
2. use jcn to read Zip file.
3. zip file contains multiple invoice.xml files
4. zip file contains multiple attachment.pdf files corresponding to invoice.xml
5. Have to create multiple 'xml messages with attachment in the xml' and push them to a queue.
With these assumptions i have created a sample flow, refer link : https://drive.google.com/folderview?id=0B4qbySw4DAiQfk5hM1pscHZIa2NTb2hXSS12VFRtcXNmOGhXRlZycENCYVRsdnZxRWI0MVE&usp=sharing
Java classes present in IBM-WMB jre were used.
1. 'java.util.zip.ZipFile' was used to read xml file
2. 'org.w3c.dom.Document' was used to work with xml.
3. 'sun.misc.BASE64Encoder' was used for Base64 conversion. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Feb 05, 2015 5:18 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
That's what you're doing. You still don't say what the problem is. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Feb 05, 2015 5:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
VishnuPrasadS wrote: |
Hi
I have assumed that you would
1. get zip file in some folder.
2. use jcn to read Zip file.
3. zip file contains multiple invoice.xml files
4. zip file contains multiple attachment.pdf files corresponding to invoice.xml
5. Have to create multiple 'xml messages with attachment in the xml' and push them to a queue.
With these assumptions i have created a sample flow, refer link : https://drive.google.com/folderview?id=0B4qbySw4DAiQfk5hM1pscHZIa2NTb2hXSS12VFRtcXNmOGhXRlZycENCYVRsdnZxRWI0MVE&usp=sharing
Java classes present in IBM-WMB jre were used.
1. 'java.util.zip.ZipFile' was used to read xml file
2. 'org.w3c.dom.Document' was used to work with xml.
3. 'sun.misc.BASE64Encoder' was used for Base64 conversion. |
So why did you use a dom Document for your xml and not parse it with the XMLNSC parser of the broker?? The same way the broker has 64bit encode and decode facilities. Why not use those?
Just because you can is no good reason to treat the broker as a java server...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
gagan.maverick |
Posted: Tue Feb 10, 2015 4:10 am Post subject: |
|
|
Acolyte
Joined: 30 Sep 2014 Posts: 50
|
Hey Vishnu
Actaully in one zip file there is only one xml file with multiple invoice tags and each of those tags have reference to some pdf files .. i mean like this
<xml file>
<Invoice 1>
<PDF ref1>
<Pdf ref2>
</Invoice 1>
<Invoice2>
<Pdf ref 3>
</invoice2>
</xml file> I have to split all the invoices with their respective attachments, but the problem is where to store all the pdfs in the flow in order to make the search .. |
|
Back to top |
|
 |
|