示例#1
0
        private static RDNPair parseNameComponent(string data, ref int pos)
        {
            RDNPair result = parseAttributeTypeAndValue(data, ref pos);

            while (pos < data.Length)
            {
                eatWhite(data, ref pos);
                if (pos < data.Length && data[pos] == '+')
                {
                    ++pos;
                }
                else
                {
                    break;
                }
                RDNPair p = parseAttributeTypeAndValue(data, ref pos);
                result.value += "+";
                result.value += p.key;
                result.value += '=';
                result.value += p.value;
            }
            return(result);
        }
示例#2
0
 private static RDNPair parseAttributeTypeAndValue(string data, ref int pos)
 {
     RDNPair p = new RDNPair();
     p.key = parseAttributeType(data, ref pos);
     eatWhite(data, ref pos);
     if(pos >= data.Length)
     {
         throw new ParseException("invalid attribute type/value pair (unexpected end of data)");
     }
     if(data[pos] != '=')
     {
         throw new ParseException("invalid attribute type/value pair (missing =). remainder: " +
                                  data.Substring(pos));
     }
     ++pos;
     p.value = parseAttributeValue(data, ref pos);
     return p;
 }