Map Flatfile schema with repeating nodes input to one XML schema with repeating nodes output BizTalk - biztalk

I'm trying to map a Flat file schema with multiple lines to an XML file with same multiple lines.
Input file example:
Username,"Certification ID","Certification Name","Date completed","Date due"
n2345678,55,"Name","2 Sep 2020",2-Mar-22
n1234567,55,"Name",,19-Mar-21
Output file example I would like to build with BizTalk mapper:
<Export>
<Certificate>
<Username>n2345678</Username>
<Date completed>2 Sep 2020</Date completed>
<Date due>2-Mar-22</Date due>
<Type>HarcodedField</Type>
<Kenmerk1>CalculatedField</Kenmerk1>
<Certification ID>55</Certification ID>
<Certification Name>Name</Certification Name>
</Certificate>
<Certificate>
<Username>n1234567</Username>
<Date completed />
<Date due>19-Mar-21</Date due>
<Type>HarcodedField</Type>
<Kenmerk1>CalculatedField</Kenmerk1>
<Certification ID>55</Certification ID>
<Certification Name>Name</Certification Name>
</Certificate>
</Export>
For now I was only able to generate this output:
<Export>
<Certificate>
<Username>n2345678</Username>
<Date completed>2 Sep 2020</Date completed>
<Date due>2-Mar-22</Date due>
<Type>HarcodedField</Type>
<Kenmerk1>CalculatedField</Kenmerk1>
<Certification ID>55</Certification ID>
<Certification Name>Name</Certification Name>
</Certificate>
</Export>
What kind of functoid I had to use to loop on each lines of the input file to generate an output file with one Export node containing several Certificate nodes?

Use the loop shape from the toolbox to map the rows from flat file schema to the "Certificate" from the output schema.
Then set maxOccurs = unbounded on the Certificate element of the output schema and it should work

Related

I don't understand how many file,i have to create

Implement the Caesar Cipher algorithm to encrypt and decrypt a file contents using C language. The cipher basic all use algorithm . Your program should have two C files named encrypt.c and decrypt.c that contains encrypt() and decrypt() functions correspondently for the purpose. In the encryption.c file, use the main() function to take input from a “input.txt” file and store the encrypted message to “enc_msg.txt” file. In the decryption.c file, use the main() function to take input from a “enc_msg.txt” file and store the decrypted message to “dec_msg.txt” file and print the decrypted message in console output as well. The key is 3.
Thanks
Create two .c files encrypt.c and decrypt.c
Create sample data input.txt file
Run your encrypt program to create output file enc_msg.txt from input.txt file
Run your decrypt program to create output file dec_msg.txt from input enc_msg.txt file
So you need to create 3 files encrypt.c decrypt.c and input.txt
And running your programs will generate two more files enc_msg.txt and dec_msg.txt

Encrypted chef data bag json file, how to decrypt and show contents?

There are encrypted data bags in json files with some values I need to change. I need to run something like...
$ knife data bag from file show --secret-file path/to/secret DATABAGNAME --config path/to/knife.rb
But this command gives the error: Could not find or open file 'DATABAGNAME' in current directory or in 'data_bags/show/ewe-jenkins'. So obviously the command is not quite right. I need help figuring out the syntax...
I need a command that can be run from the chef-repo, or the data_bags directory, that will allow me to see the unencrypted values of the json file data_bags. Ultimately I want to change some values, but getting the unencrypted values would be a good place to start :) thanks!
Since you're talking about local json files I'll assume you are using chef-zero / local-mode. The json file can indeed be encrypted and the content can be decrypted with knife.
Complete example:
Create key and databag item:
$ openssl rand -base64 512 | tr -d '\r\n' > /tmp/encrypted_data_bag_secret
$ knife data bag create mydatabag secretstuff --secret-file /tmp/encrypted_data_bag_secret -z
Enter this:
{
"id": "secretstuff",
"firstsecret": "must remain secret",
"secondsecret": "also very secret"
}
The json file is indeed encrypted:
# cat data_bags/mydatabag/secretstuff.json
{
"id": "secretstuff",
"firstsecret": {
"encrypted_data": "VafoT8Jc0lp7o4erCxz0WBrJYXjK6j+sJ+WGKJftX4BVF391rA1zWyHpToF0\nqvhn\n",
"iv": "MhG09xFcwFAqX/IA3BusMg==\n",
"version": 1,
"cipher": "aes-256-cbc"
},
"secondsecret": {
"encrypted_data": "Epj+2DuMOsf5MbDCOHEep7S12F6Z0kZ5yMuPv4a3Cr8dcQWCk/pd58OPGQgI\nUJ2J\n",
"iv": "66AcYpoF4xw/rnYfPegPLw==\n",
"version": 1,
"cipher": "aes-256-cbc"
}
}
Show decrypted content with knife:
# knife data bag show mydatabag secretstuff -z --secret-file /tmp/encrypted_data_bag_secret
Encrypted data bag detected, decrypting with provided secret.
firstsecret: must remain secret
id: secretstuff
secondsecret: also very secret
I think you are confusing the knife data bag show and knife data bag from file commands. The former is for displaying data from the server, the latter is for uploading it. You have both on the command line.

Process many EDI files through single MFX

I've created a mapping in MapForce 2013 and exported the MFX file. Now, I need to be able to run the mapping using MapForce Server. The problem is, I need to specify both the input EDI file and the output file. As far as I can tell, the usage pattern is to run the mapping with MapForce server using the input/output configuration in the MFX itself, not passed in on the command line.
I suppose I could change the input/output to some standard file name and then just write the input file to that path before performing the mapping, and then grab the output from the standard output file path when the mapping is complete.
But I'd prefer to be able to do something like:
MapForceServer run -in=MyInputFile.txt -out=MyOutputFile.xml MyMapping.mfx > MyLogFile.txt
Is something like this possible? Perhaps using parameters within the mapping?
There are two options that I've come across in dealing with a similar situation.
Option 1- If you set the input XML file to *.xml in the component settings, mapforceserver.exe will automatically process all txt in the directory assuming your source is xml (this should work for text just the same). Similar to the example below you can set a cleanup routine to move the files into another folder after processing.
Note: It looks in the folder where the schema file is located.
Option 2 - Since your output is XML you can use Altova's raptorxml (rack up another license charge). Now you can generate code in XSLT 2.0 and use a batch file to automatically execute, something like this.
::#echo off
for %%f IN (*.xml) DO (RaptorXML xslt --xslt-version=2 --input="%%f" --output="out/%%f" %* "mymapping.xslt"
if NOT errorlevel 1 move "%%f" processed
if errorlevel 1 move "%%f" error)
sleep 15
mymapping.bat
I tossed in a sleep command to loop the batch for rechecking every 15 seconds. Unfortunately this does not work if your output target is a database.

BizTalk XML to EDIFACT EDI assembler hitting exception

I am currently trying to convert a XML file using XSLT to a EDIFACT format file.
Translation phase seems to be fine. By using a passthru send port i am able to obtain the EDIFACT file in XML format. However, once I try to pass the file to EDISend pipeline the I am hitting the exception
Error details: "Delimiter Set could not be read from the interchange. The attribute DelimiterSetSerializedData is missing from root node"
For this particular translation I am using EdifactInterchangeXml as the target schema.
Within the XSLT itself i have also declared the following segments:
<ex0:EdifactInterchangeXml DelimiterSetSerializedData="39:-1:-1:43:58:63:42:44:-1" xmlns:ex0="http://schemas.microsoft.com/Edi/Edifact">
<!--UNB-->
<ex1:UNB xmlns:ex1="http://schemas.microsoft.com/Edi/EdifactServiceSchema">
<UNB1>
<UNB1.1><xsl:text>UNOA</xsl:text></UNB1.1>
<UNB1.2><xsl:text>1</xsl:text></UNB1.2>
</UNB1>
<UNB2>
<UNB2.1><xsl:text>PSA</xsl:text></UNB2.1>
</UNB2>
<UNB3>
<UNB3.1><xsl:value-of select="userCSharp:Mandatory(substring($Desc_COMMID,1,35))"/></UNB3.1>
</UNB3>
<UNB4>
<UNB4.1><xsl:value-of select="substring($DT,3,6)"/></UNB4.1>
<UNB4.2><xsl:value-of select="substring($DT,9,4)"/></UNB4.2>
</UNB4>
<UNB5><xsl:text>(EBP)001</xsl:text></UNB5>
<xsl:if test="$Desc_COMMID">
<UNB10><xsl:value-of select="substring($Desc_COMMID,1,35)"/></UNB10>
</xsl:if>
</ex1:UNB>
<ex2:TransactionSetGroup xmlns:ex2="http://schemas.microsoft.com/Edi/Edifact">
<ex3:TransactionSet DocType="http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006#EFACT_1911_BAPLIE" xmlns:ex3="http://schemas.microsoft.com/Edi/Edifact">
<ns0:EFACT_1911_BAPLIE>
<!--UNH-->
<UNH>
<UNH1><xsl:text>(EBP)0001</xsl:text></UNH1>
<UNH2>
<UNH2.1><xsl:text>BAPLIE</xsl:text></UNH2.1>
<UNH2.2><xsl:text>1</xsl:text></UNH2.2>
<UNH2.3><xsl:text>911</xsl:text></UNH2.3>
<UNH2.4><xsl:text>UN</xsl:text></UNH2.4>
<UNH2.5><xsl:text>SMDG15</xsl:text></UNH2.5>
</UNH2>
</UNH>
Any suggestion what could have caused the above error?

How to get alt text from images in a docx file using Open XML and C#

I am creating a web form that will do a 508 compliance check on word documents. I am looking through MSDN and other sites for getting the information I need from a file the user selects. The one thing I can't find is how to find images, and check to see if they have alternative text. Any help would be GREATLY appreciated!
Images inserted into 2007+ Word documents are Drawing objects. So you can traverse the XML for w:drawing members.
http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.drawing.aspx
The w:drawing member will have a child called w:inline which is a part of the Inline class.
http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.wordprocessing.inline.aspx
The w:inline member will have a member called wd:docPr.
http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.wordprocessing.docproperties.aspx
The wd:docPr member may have a field called title which houses the alternative text title and a field called descr which houses all the alternative text.
Example XML:
<w:drawing xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<wp:inline distT="0" distB="0" distL="0" distR="0" wp14:anchorId="357A850A" wp14:editId="384E9053" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">
<wp:extent cx="5943600" cy="4457700" />
<wp:effectExtent l="0" t="0" r="0" b="0" />
<wp:docPr id="1" name="Picture 1" descr="ALL TEXT HERE" title="ALT TEXT TITLE HERE"/>
...
I highly recommend you use the OpenXML Productivity Tool that comes with the OpenXML SDK.
You can do the same thing slightly more easily with unzip and a copy of lxprintf (part of the LTXML2 toolkit), by unzipping the slides in a loop and running lxprintf on each one to locate the wp:docPr element and output the values of #descr and #title, eg
for f in `unzip -l demo.pptx | grep ppt/slides/slide.*\.xml | awk '{print $NF}'`; do
unzip -p demo.pptx $f |\
lxprintf -e 'w:drawing/wp:inline/wp:docPr' "%s, %s\n" #descr #title -
done

Resources