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,14 +332,17 @@ cmXmlRC_t  _cmXmlParseAttr( cmXml_t* p, cmChar_t endChar,  cmXmlNode_t* np )
332 332
   if((v0 = _cmXmlAdvanceToNextNonWhite(p)) == NULL )
333 333
     return _cmXmlSyntaxError(p);
334 334
 
335
+  char begChar = *p->c;
336
+  
335 337
   // the first character in the value must be a single quote
336
-  if( *p->c == '\'' )
338
+  if( begChar == '\'' || begChar == '"' )
337 339
   {
338 340
     if((v0 = _cmXmlAdvanceOne(p)) == NULL )
339 341
       return _cmXmlSyntaxError(p);
340
-    
342
+
343
+    char endStr[] = { begChar, 0 };
341 344
     // advance to the next single quote
342
-    v1 = _cmXmlAdvanceToNext(p,"'");
345
+    v1 = _cmXmlAdvanceToNext(p,endStr);
343 346
   }
344 347
   else
345 348
   {
@@ -350,7 +353,7 @@ cmXmlRC_t  _cmXmlParseAttr( cmXml_t* p, cmChar_t endChar,  cmXmlNode_t* np )
350 353
     return _cmXmlSyntaxError(p);
351 354
 
352 355
   
353
-  // advance past the ending single quote
356
+  // advance past the ending  quote
354 357
   if( *p->c != endChar )
355 358
     if( _cmXmlAdvanceOne(p) == NULL )
356 359
       return _cmXmlSyntaxError(p);
@@ -359,7 +362,7 @@ cmXmlRC_t  _cmXmlParseAttr( cmXml_t* p, cmChar_t endChar,  cmXmlNode_t* np )
359 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 366
   return rc;
364 367
 }
365 368
 

Loading…
Cancel
Save