AddAttribute() 개인적인 메소드

private AddAttribute ( String key, String value ) : int
key String
value String
리턴 int
예제 #1
0
파일: cfgparser.cs 프로젝트: ydunk/masters
 public void CreateAttribute(int size,
                             ConfigNodeSubType subType,
                             ConfigNodeType nType,
                             int terminal,
                             [MarshalAs(UnmanagedType.LPWStr)] String text,
                             int textLength,
                             int prefixLength)
 {
     //Trace("CreateAttribute",size,subType,nType,terminal,text,textLength,prefixLength,0);
     if (parsing)
     {
         // if the value of the attribute is null, the parser doesn't come back, so need to store the attribute when the
         // attribute name is encountered
         if (nType == ConfigNodeType.Attribute)
         {
             attributeEntry = currentNode.AddAttribute(text, "");
             key            = text;
         }
         else if (nType == ConfigNodeType.PCData)
         {
             currentNode.ReplaceAttribute(attributeEntry, key, text);
         }
         else
         {
             throw new ApplicationException(String.Format(Environment.GetResourceString("XML_Syntax_InvalidSyntaxInFile"), fileName, lastProcessed));
         }
     }
 }
예제 #2
0
 public override void CreateAttribute(int size,
                                      ConfigNodeSubType subType,
                                      ConfigNodeType nType,
                                      int terminal,
                                      [MarshalAs(UnmanagedType.LPWStr)] String text,
                                      int textLength,
                                      int prefixLength)
 {
     //Trace("CreateAttribute",size,subType,nType,terminal,text,textLength,prefixLength,0);
     if (parsing)
     {
         // if the value of the attribute is null, the parser doesn't come back, so need to store the attribute when the
         // attribute name is encountered
         if (nType == ConfigNodeType.Attribute)
         {
             attributeEntry = currentNode.AddAttribute(text, "");
             key            = text;
         }
         else if (nType == ConfigNodeType.PCData)
         {
             currentNode.ReplaceAttribute(attributeEntry, key, text);
         }
         else
         {
             String message = GetInvalidSyntaxMessage();
             // Neither Exception nor ApplicationException are the "right" exceptions here.
             // Desktop throws ApplicationException for backwards compatibility.
             // On Silverlight we don't have ApplicationException, so fall back to Exception.
             throw new Exception(message);
         }
     }
 }