XML file using Perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting XML file using Perl
# 1  
Old 09-19-2008
XML file using Perl

Hi All,

Does anyone know how to generate an XML file using perl scripting? Thanks in advance.

Regards,

P AGARWAL
# 2  
Old 09-19-2008
Code:
perl -le 'print "<xml>here</xml>" >file.xml

Jokes aside, you need to be much more specific about what you want.
# 3  
Old 09-19-2008
I need to generate an xml file using perl script. The content of the xml script should be as follows: These represent the header of the file.
<REQUEST Name="vinScheduled">
<EVENT_CODE Value="" />
<EVENT_NAME Value="" />
<CREATED_BY_ID Value="" />
<OCCURRENCE_DATE Value="" />
<REP_SYSTEM_DATE Value="" />
<REP_SYSTEM_DATE_TZ Value="" />
<SHIP_FROM_ID Value="" />
<SHIP_TO_ID Value="" />
<KEEP_IDS Value="" />
<ID Value="" />
<PRODUCTION_ORDER_NUMBER Value="" />
<SELLING_SOURCE Value="" />
<SHIP_TO_DEALER_CODE Value="" />
<ORDER_DEALER_CODE Value="" />
<DELIVERY_DATE Value="" />
<SHIP_DATE Value="' />
<ITEM_ID Value="" />
<SALES_ORGANIZATION_NO Value="" />
<IS_OWN_PROCESSOR Value="" />
<VIN_ATTRIBUTES>
<MODEL_YEAR Value="" />
</VIN_ATTRIBUTES>
</REQUEST>


Between the inverted commas, i'll be inserting some variable values.
# 4  
Old 09-19-2008
If this is basically a static text, it's still more or less a single print.

Code:
$event_code="fnord";
$event_name="Beverly";
print <<HERE;
<REQUEST Name="vinScheduled">
<EVENT_CODE Value="$event_code" />
<EVENT_NAME Value="$event_name" />
:
</REQUEST>
HERE

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Splitting xml file into several xml files using perl

Hi Everyone, I'm new here and I was checking this old post: /shell-programming-and-scripting/180669-splitting-file-into-several-smaller-files-using-perl.html (cannot paste link because of lack of points) I need to do something like this but understand very little of perl. I also check... (4 Replies)
Discussion started by: mcosta
4 Replies

2. UNIX for Advanced & Expert Users

Convert CSV file to nested XML file using UNIX/PERL?

we have a CSV which i need to convert to XML using Perl or Unix shell scripting. I was able to build this XML in oracle database. However, SQL/XML query is running for long time. Hence, I'm considering to write a Perl or shell script to generate this XML file. Basically need to build this XML... (3 Replies)
Discussion started by: laknar
3 Replies

3. Shell Programming and Scripting

Perl : to split the tags from xml file

I do have an xml sheet as below where I need the perl script to filter only the hyperlink tags. <cols><col min="1" max="1" width="30.5703125" customWidth="1"/><col min="2" max="2" width="7.140625" bestFit="1" customWidth="1"/> <col min="3" max="3" width="32.28515625" bestFit="1"... (3 Replies)
Discussion started by: scriptscript
3 Replies

4. Shell Programming and Scripting

Help in parsing XML output file in perl.

Hi I have an XML output like : <?xml version="1.0" encoding="ISO-8859-1" ?> - <envelope> - <body> - <outputGetUsageSummary> - <usgSumm rerateDone="5"> - <usageAccum accumId="269" accumCaptn="VD_DP_AR" inclUnits="9999999.00" inclUnitsUsed="0.00" shared="false" pooled="false"... (7 Replies)
Discussion started by: rkrish
7 Replies

5. Shell Programming and Scripting

perl script to update a xml file

Hi experts, I have a set of xml files in folder which has the below field. <mm:sessionID>157.235.206.12900397BE4:A</mm:sessionID>, I need to update this field regularly with new session id, which I have it from a login file. Can anyone tell me how to add a new value in <mm:sessionID>... (3 Replies)
Discussion started by: amvarma77
3 Replies

6. Shell Programming and Scripting

How to create a xml file using Perl Script

Hi All, I have some data which needs to be saved in the xml file format.Can you guys please let me know how to do this using perl script. NOTE: the template of the xml file shall be depending on validation of the data done for some requirements. Basically to summarise, the fields in the xml... (5 Replies)
Discussion started by: girish.raos
5 Replies

7. Shell Programming and Scripting

Perl: update lastmod in xml file

I'm trying to write a perl script that I can run as a cron job in root of my web server that will look for .shtml files get their last modified date and replace it in the sitemap_test.xml file. the problem is the substitution doesn't work and when I print to MYFILE it adds the lastmod to the end of... (3 Replies)
Discussion started by: skilodge
3 Replies

8. Shell Programming and Scripting

Perl script to extract 'ID' From XML File

File1.xml <?xml version.........> - <abcd:abcd_list version="1" www.john_uncle's_server.com" xmlns: - <device id="100"> <firmware>12.4(3d)</firmware> <location id="500">Sitting Room</location> </device> - <device id="101"> <firmware>12.4(3d)</firmware> <location id="501">Class... (1 Reply)
Discussion started by: sureshcisco
1 Replies

9. Shell Programming and Scripting

Convert XML file into TEXT file using PERL seript

Dear Yogesh..."Convert XML file into TEXT file using PERL seript"... can u help me regarding this issue...plz Thanks Rudro (0 Replies)
Discussion started by: Rudro
0 Replies

10. Shell Programming and Scripting

How to parse a XML file using PERL and XML::DOm

I need to know the way. I have got parsing down some nodes. But I was unable to get the child node perfectly. If you have code please send it. It will be very useful for me. (0 Replies)
Discussion started by: girigopal
0 Replies
Login or Register to Ask a Question