Ejemplo n.º 1
0
 public XmlDocument()
 {
     members = new Dictionary <string, Variable>
     {
         { "Content", new FVariable
           {
               ongetvalue = () =>
               {
                   if (FirstChild.GetType() == typeof(SXml.XmlElement))
                   {
                       return(new XmlElement(FirstChild as SXml.XmlElement));
                   }
                   else if (FirstChild.GetType() == typeof(SXml.XmlComment))
                   {
                       return(new XmlComment(FirstChild as SXml.XmlComment));
                   }
                   else
                   {
                       throw new Exceptions.RunException(Exceptions.EXID.未知);
                   }
               },
               onsetvalue = (value) =>
               {
                   if (FirstChild != null)
                   {
                       RemoveChild(FirstChild);
                   }
                   AppendChild((SXml.XmlNode)value.IGetCSValue());
                   return(0);
               }
           } },
         { "CreatElement", new Variable(new MFunction(createlement, this)) },
         { "CreatComment", new Variable(new MFunction(creatcomment, this)) },
         { "Save", new Variable(new MFunction(save, this)) },
         { "Load", new Variable(new MFunction(load, this)) },
         { "LoadFromText", new Variable(new MFunction(loadfromtext, this)) }
     };
 }