Actually i want to do few changes in code. i read input sample.xml file.
="1.0"="UTF-8"="no"
<!DOCTYPE labels SYSTEM "label.dtd">
<labels _FORMAT ="BARCODE" _QUANTITY="1" _PRINTERNAME="P1">
<label>
<variable name= "PRTNUM">234243242</variable>
<variable name= "QUANTY">004342</variable>
<variable name= "PONUMB">844463541</variable>
<variable name= "SERIAL">DZ12</variable>
<variable name= "REV">234235</variable>
<variable name= "UNITS">234235</variable>
</label>
</labels>
& parsed data is placed in parsed.txt
234243242
004342
844463541
DZ12
234235
234235
this data is then merged with barcode.txt
c0001
f260
L
D11
H30
R0000
C0040
1X1100000100010B300300003003
181100202900027Part No
181100202900097[PRTNUM]
1e5504002400030B
1X1100002300010L300003
191100202000030Quantity
191100202000080[QUANTY]
1e5504001500040B
1X1100001400010L300003
1X1100001400150L003090
191100202000170P.O.No
191100202000220[PONUMB]
1e5504001500180B
191100201200030Supplier
1e3304000700030B
1X1100000600010L300003
181100200300030Serial
181100200300090[SERIAL]
171100300900190Rev
171100300300190[REV]
171100300900240Units
171100300300240[UNITS]
1X1100000100180L003130
Q0001
E
But while merging the data it is merged irrespective of the tag name that is included in xml & barcode file.
e.g
if i put [QUANTY] at the position of [PRTNUM] it will place the same data 234243242 (which actually for [PRTNUM]).
How to make it possible that my program will read the data inside [...] from barcode.txt file & then place the corresponding data from parsed file at that position.
my c code xmldpl.txt
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<DIR.h>
#include<string.h>
int main()
{
clrscr();
char a[1];
char cBuffer[50] = {0};
char ch, cSkipdata;
FILE* fPtr;
FILE* fPparse;
FILE* fPin;
FILE* fPout;
char* Ptr;
getcwd(cBuffer, 100);
printf("The current directory is %s\n\n",cBuffer);
fPtr = fopen("sample.xml", "r");
fPparse = fopen("parse.txt","w");
if(fPtr)
{
printf("The file is\n\n");
scanf("%c",&a[1]);
cSkipdata=1;
while ((ch = getc(fPtr)) != EOF)
{
if(ch == '<')
cSkipdata=1;
if(!cSkipdata && ch != ' ')
{
putchar(ch);
fputc(ch, fPparse);
}
if(ch == '>')
cSkipdata=0;
}
fclose(fPtr);
fclose(fPparse);
}
else
{
printf("file can not open\n");
}
fPin = fopen("barcode.txt", "r");
fPout = fopen("final.txt", "w");
fPparse = fopen("parse.txt","r");
scanf("%c",&a[1]);
printf("\n\nfinal.txt is \n");
cSkipdata = 0;
while((ch = getc(fPin)) != EOF)
{
if(ch == '[')
{
int iLine=0;
cSkipdata = 1;
while ( (ch = getc(fPparse)) != EOF)
{
if((ch=='\n') && (iLine>0) )
break;
if(ch > ' ')
{
iLine++;
putchar(ch);
fputc(ch, fPout);
}
}
}
if(cSkipdata)
{
if(ch == ']')
cSkipdata = 0;
}
else
{
putchar(ch);
fputc(ch ,fPout);
}
}
fclose(fPin);
fclose(fPout);
fclose(fPparse);
getch();
}