390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
|
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
|
+
-
-
-
-
+
+
+
+
+
+
|
** a valid markup. If it is, return the total number of characters in
** the markup including the initial "<" and the terminating ">". If
** it is not well-formed markup, return 0.
*/
static int markupLength(const char *z){
int n = 1;
int inparen = 0;
int c;
if( z[n]=='/' ){ n++; }
if( !isalpha(z[n]) ) return 0;
while( isalnum(z[n]) ){ n++; }
if( z[n]!='>' && !isspace(z[n]) ) return 0;
while( z[n] && (z[n]!='>' || inparen) ){
if( z[n]=='"' ){
inparen = !inparen;
if( (c = z[n])!='>' && !isspace(c) ) return 0;
while( (c = z[n])!=0 && (c!='>' || inparen) ){
if( c==inparen ){
inparen = 0;
}else if( c=='"' || c=='\'' ){
inparen = c;
}
n++;
}
if( z[n]!='>' ) return 0;
return n+1;
}
|
711
712
713
714
715
716
717
718
719
720
721
722
723
724
|
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
|
+
+
+
+
|
}else{
i++;
while( isspace(z[i]) ){ z++; }
if( z[i]=='"' ){
i++;
zValue = &z[i];
while( z[i] && z[i]!='"' ){ i++; }
}else if( z[i]=='\'' ){
i++;
zValue = &z[i];
while( z[i] && z[i]!='\'' ){ i++; }
}else{
zValue = &z[i];
while( !isspace(z[i]) && z[i]!='>' ){ z++; }
}
if( attrOk ){
p->aAttr[p->nAttr].zValue = zValue;
p->aAttr[p->nAttr].cTerm = c = z[i];
|