Hi.....
I have to parse through an input XML file line-by-line, character-by-character and find if closing HTML tags are present for every opening HTML tag.
When printing to the output I find that any character that is printed just after '>' character without any spaces will not be printed to the output. Also no spaces from the input text is printed to the output.Code:MAIN program: while (scanf("%s", code) != EOF) { i=0; length = strlen(code); while (i < strlen(code)) { c=code[i]; if (c == '<') { j=0; do { c=code[i]; element[j]=c; ++i; j++; }while(c!='>'); c=code[++i]; element[j] = '\0'; if (element[1] == '/') { l=element[2]; length = strlen(element); for (k=0;k<=length-4;k++) { check[k]=element[l++]; } check[k] = '\0'; /*Function passsed tho process the element()*/ printf("%s",element); } else { l=element[1]; length = strlen(element); for (k=0;k<=length-3;k++) { check[k]=element[l++]; } check[k]='\0'; /*Function passsed tho process the element()*/ printf("%s",element); } } else { putchar(c); c=code[++i]; } } }
Please help



LinkBack URL
About LinkBacks




