Tuesday, 24 February 2015

perl script that reads value from xml file and substitute in c code template to generate a c file



i have one xml file and one .c file .



xml file :
<?xml version="1.0"?>
<Sheet Name="fruits">
<Row ="2">
<cell="1">
<Type="string">APPLE</Type>
</cell>
</Row>
<Row ="3">
<cell="2">
<Type="string">BANANA</Type>
</cell>
</Row>
<Row ="4">
<cell="3">
<Type="string">GRAPES</Type>
</cell>
</Row>
<Sheet Name="Vegetables">
<Row ="2">
<cell="1">
<Type="string">ladyfingers</Type>
</cell>
</Row>
<Row ="3">
<cell="2">
<Type="string">onion</Type>
</cell>
</Row>
<Row ="4">
<cell="3">
<Type="string">cucumber</Type>
</cell>
</Row>

and my c code file is having
/* data related to fruits and vegetables*/
Human item <fruites>
{
<APPLES><BANANA><GRAPES>
}
Human item<Vegetables>
{
<onion><cucumber><ladyfingers>
}


and i need a perl scripting that reads value from xml file and substitute in c code template to generate a c file. in total we are giving input two files (XML file and C file) output is c file. i initially thought using XML :: Simple parser please help me am new to perl scripting . thank you in advance


No comments:

Post a Comment