Browse Source

cmXml.c : Allow attributes to be wrapped in single or double quotes.

master
kevin 3 years ago
parent
commit
e29b975677
1 changed files with 8 additions and 5 deletions
  1. 8
    5
      src/cmXml.c

+ 8
- 5
src/cmXml.c View File

332
   if((v0 = _cmXmlAdvanceToNextNonWhite(p)) == NULL )
332
   if((v0 = _cmXmlAdvanceToNextNonWhite(p)) == NULL )
333
     return _cmXmlSyntaxError(p);
333
     return _cmXmlSyntaxError(p);
334
 
334
 
335
+  char begChar = *p->c;
336
+  
335
   // the first character in the value must be a single quote
337
   // the first character in the value must be a single quote
336
-  if( *p->c == '\'' )
338
+  if( begChar == '\'' || begChar == '"' )
337
   {
339
   {
338
     if((v0 = _cmXmlAdvanceOne(p)) == NULL )
340
     if((v0 = _cmXmlAdvanceOne(p)) == NULL )
339
       return _cmXmlSyntaxError(p);
341
       return _cmXmlSyntaxError(p);
340
-    
342
+
343
+    char endStr[] = { begChar, 0 };
341
     // advance to the next single quote
344
     // advance to the next single quote
342
-    v1 = _cmXmlAdvanceToNext(p,"'");
345
+    v1 = _cmXmlAdvanceToNext(p,endStr);
343
   }
346
   }
344
   else
347
   else
345
   {
348
   {
350
     return _cmXmlSyntaxError(p);
353
     return _cmXmlSyntaxError(p);
351
 
354
 
352
   
355
   
353
-  // advance past the ending single quote
356
+  // advance past the ending  quote
354
   if( *p->c != endChar )
357
   if( *p->c != endChar )
355
     if( _cmXmlAdvanceOne(p) == NULL )
358
     if( _cmXmlAdvanceOne(p) == NULL )
356
       return _cmXmlSyntaxError(p);
359
       return _cmXmlSyntaxError(p);
359
   _cmXmlAttrAlloc(p, np, l0, l1-l0, v0, v1-v0 );
362
   _cmXmlAttrAlloc(p, np, l0, l1-l0, v0, v1-v0 );
360
   
363
   
361
 
364
 
362
-  // p->c now points just past the ending single quote
365
+  // p->c now points just past the ending quote
363
   return rc;
366
   return rc;
364
 }
367
 }
365
 
368
 

Loading…
Cancel
Save