Example #1
0
 private bool eatAttr(TextProcessor textProcessor)
 {
     // attr1="xxx yyy" attr2 = "yyy"
     //
     textProcessor.EatSpace();
     if (textProcessor.End()) return false;
     //
     string attrValue = null;
     //
     string attrName = textProcessor.EatName();
     if (string.IsNullOrEmpty(attrName)) return false;
     textProcessor.EatSpace();
     //
     if (textProcessor.EatChar('='))
     {
         textProcessor.EatSpace();
         char valueStartChar = textProcessor.Current();
         if ((valueStartChar == '\"') || (valueStartChar == '\''))
         {
             attrValue = textProcessor.EatQuoted(valueStartChar);
         }
         else
         {
             attrValue = textProcessor.EatNonSpace();
         }
     }
     //
     this.Attributes[attrName] = attrValue;
     //
     return true;
 }
Example #2
0
 private NameValue eatAttr(TextProcessor textProcessor)
 {
     textProcessor.EatSpace();
     if (textProcessor.End()) return null;
     //
     string attrValue = null;
     //
     string attrName = textProcessor.EatName();
     textProcessor.EatSpace();
     //
     if (textProcessor.EatChar('='))
     {
         textProcessor.EatSpace();
         char valueStartChar = textProcessor.Current();
         if ((valueStartChar == '\"') || (valueStartChar == '\''))
         {
             attrValue = textProcessor.EatQuoted(valueStartChar);
         }
         else
         {
             attrValue = textProcessor.EatNonSpace();
         }
     }
     //
     return new NameValue() { Name = attrName, Value = attrValue };
 }