当前位置: 首页>>代码示例>>C#>>正文


C# XmlElement.AppendChild方法代码示例

本文整理汇总了C#中XmlElement.AppendChild方法的典型用法代码示例。如果您正苦于以下问题:C# XmlElement.AppendChild方法的具体用法?C# XmlElement.AppendChild怎么用?C# XmlElement.AppendChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlElement的用法示例。


在下文中一共展示了XmlElement.AppendChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToXmlElement

	public override void ToXmlElement (XmlDocument doc, XmlElement parent) {
		AddAttributesToXml (doc, parent, this);
		AddPropertiesToXml (doc, parent, this);

		XmlElement app = doc.CreateElement ("application");
		_applicationTemplate.ToXmlElement (doc, app);
		parent.AppendChild (app);

		foreach (AN_PropertyTemplate permission in Permissions) {
			XmlElement p = doc.CreateElement("uses-permission");
			permission.ToXmlElement(doc, p);
			parent.AppendChild(p);
		}
	}
开发者ID:sonxoans2,项目名称:TapJump,代码行数:14,代码来源:AN_ManifestTemplate.cs

示例2: DumpContent

 public override void DumpContent(XmlDocument document, XmlElement element)
 {
     XmlElement elm = document.CreateElement("Response");
     XmlAttribute attr = document.CreateAttribute("type");
     attr.Value = this._rtype;
     elm.Attributes.Append(attr);
     base.DumpContent(document, elm);
     element.AppendChild(elm);
 }
开发者ID:spox,项目名称:irisim,代码行数:9,代码来源:Response.cs

示例3: ToXmlElement

	public override void ToXmlElement (XmlDocument doc, XmlElement parent)
	{
		AddAttributesToXml (doc, parent, this);
		AddPropertiesToXml (doc, parent, this);

		foreach (int id in _activities.Keys) {
			XmlElement activity = doc.CreateElement ("activity");
			_activities[id].ToXmlElement(doc, activity);
			parent.AppendChild (activity);
		}
	}
开发者ID:sonxoans2,项目名称:TapJump,代码行数:11,代码来源:AN_ApplicationTemplate.cs

示例4: AppendArray

    public void AppendArray(object[] array, string name, XmlElement parent)
    {
        XmlElement arrayElement = parent.OwnerDocument.CreateElement(name);

        for (int i = 0; i < array.Length; i++)
        {
            AppendXmlElement("entry", array[i].ToString(), arrayElement);
        }

        parent.AppendChild(arrayElement);
    }
开发者ID:mkapolka,项目名称:flash-component,代码行数:11,代码来源:OutputComponent.cs

示例5: makeBall

    private void makeBall(float x, float y, float z, XmlElement level, XmlDocument xmlDoc)
    {
        XmlElement ball = xmlDoc.CreateElement("ball");
        ball.SetAttribute("x",x.ToString());
        ball.SetAttribute("y",y.ToString());
        ball.SetAttribute("z",z.ToString());

        ball.SetAttribute("type","randColor");

        level.AppendChild(ball);
    }
开发者ID:ringstadjr,项目名称:BubbleShooter3D,代码行数:11,代码来源:LevelManager.cs

示例6: DumpContent

 public override void DumpContent(XmlDocument document, XmlElement element)
 {
     XmlElement val = null;
     XmlAttribute valName = null;
     ICollection keys = this._content.Keys;
     foreach(Object o in keys)
     {
         val = document.CreateElement("Value");
         valName = document.CreateAttribute("name");
         valName.Value = (string)o;
         val.InnerXml = (string)this._content[o];
         val.Attributes.Append(valName);
         element.AppendChild(val);
     }
 }
开发者ID:spox,项目名称:irisim,代码行数:15,代码来源:BasicContent.cs

示例7: DumpContent

 public override void DumpContent(XmlDocument document, XmlElement element)
 {
     XmlElement elm = document.CreateElement("Part");
     XmlAttribute id = document.CreateAttribute("id");
     id.Value = this._ID.ToString();
     elm.Attributes.Append(id);
     XmlAttribute total = document.CreateAttribute("total");
     total.Value = this._total.ToString();
     elm.Attributes.Append(total);
     XmlElement val = document.CreateElement("Value");
     XmlAttribute name = document.CreateAttribute("name");
     name.Value = "data";
     val.Attributes.Append(name);
     val.InnerXml = this._data;
     elm.AppendChild(val);
     element.AppendChild(elm);
 }
开发者ID:spox,项目名称:irisim,代码行数:17,代码来源:Part.cs

示例8: DumpContent

 public override void DumpContent(XmlDocument document, XmlElement element)
 {
     XmlElement elm = document.CreateElement("ChatMessage");
     XmlAttribute attr;
     if(this._destination != null)
     {
         attr = document.CreateAttribute("destination");
         attr.Value = this._destination;
         elm.Attributes.Append(attr);
     }
     if(this._originator != null)
     {
         attr = document.CreateAttribute("originator");
         attr.Value = this._originator;
         elm.Attributes.Append(attr);
     }
     base.DumpContent(document, elm);
     element.AppendChild(elm);
 }
开发者ID:spox,项目名称:irisim,代码行数:19,代码来源:Chat.cs

示例9: Populate

    private void Populate (XmlElement root)
    {

        int year = DateTime.Now.Year; ;

        FinancialAccounts allAccounts = FinancialAccounts.ForOrganization(Organization.PPSE);

        foreach (FinancialAccount account in allAccounts)
        {
            if (
                ((account.AccountType == FinancialAccountType.Cost 
                    || account.AccountType == FinancialAccountType.Income) 
                && Request["type"] == null)
            ||
                (account.AccountType == FinancialAccountType.Cost && Request["type"] == "Cost") 
            ||
                (account.AccountType == FinancialAccountType.Income) && Request["type"] == "Income")
            {
                string budget = Math.Round(account.GetBudget(year)).ToString();
                string actual = Math.Round(-account.GetDelta(new DateTime(year, 1, 1), new DateTime(year + 1, 1, 1))).ToString();
                XmlElement XAccount = xDoc.CreateElement("account");
                root.AppendChild(XAccount);
                XAccount.SetAttribute("id", account.FinancialAccountId.ToString());
                XAccount.SetAttribute("name", account.Name);
                XAccount.SetAttribute("parentid", account.ParentFinancialAccountId.ToString());
                XAccount.SetAttribute("ownerid", account.OwnerPersonId.ToString());
                if (localCall)
                {
                    if (account.Owner != null)
                    {
                        XAccount.SetAttribute("ownername", account.Owner.Name);
                        XAccount.SetAttribute("ownerphone", account.Owner.Phone);
                        XAccount.SetAttribute("ownermail", account.Owner.PartyEmail);
                    }
                    XAccount.SetAttribute("actual", actual);
                }
                XAccount.SetAttribute("budget", budget);
            }
        }
    }
开发者ID:SwarmCorp,项目名称:Swarmops,代码行数:40,代码来源:Budgets.aspx.cs

示例10: GenerateDirectoryXml

 private void GenerateDirectoryXml(ref XmlDocument xmlDoc, ref XmlElement parentElement, DirectoryInfo directory)
 {
     XmlElement directoryElement = xmlDoc.CreateElement("directory");
     directoryElement.SetAttribute("name", directory.Name);
     parentElement.AppendChild(directoryElement);
     //directoryElement.SetAttribute("parent", parentElement.GetAttribute("name"));
     directoryElement.SetAttribute("parent", GetParentText(directoryElement));
     if (directory.GetDirectories().Length != 0)
     {
         directoryElement.SetAttribute("isParent", "true");
         XmlElement subDirectoryElement = xmlDoc.CreateElement("subdirectories");
         foreach (DirectoryInfo subDirectory in directory.GetDirectories())
         {
             GenerateDirectoryXml(ref xmlDoc, ref subDirectoryElement, subDirectory);
         }
         directoryElement.AppendChild(subDirectoryElement);
     }
     else
     {
         directoryElement.SetAttribute("isParent", "false");
         string extension = string.Empty;
         foreach (FileInfo file in directory.GetFiles())
         {
             extension = file.Extension.Substring(file.Extension.LastIndexOf('.') + 1);
             XmlElement fileElement;
             if (String.Compare(extension, "JPG", true) == 0)
             {
                 fileElement = xmlDoc.CreateElement("file");
                 fileElement.SetAttribute("name", file.Name);
                 //fileElement.InnerText = file.Name;
                 //directoryElement.AppendChild(fileElement);
                 directoryElement.AppendChild(fileElement);
             }
         }
     }
 }
开发者ID:adayalantitan,项目名称:Apollo,代码行数:36,代码来源:MakeXml.aspx.cs

示例11: SaveElement

 public override void SaveElement(XmlDocument xmlDoc, XmlElement dynEl)
 {
     //Debug.WriteLine(pd.Object.GetType().ToString());
     XmlElement outEl = xmlDoc.CreateElement("Symbol");
     outEl.SetAttribute("value", Symbol);
     dynEl.AppendChild(outEl);
 }
开发者ID:romeo08437,项目名称:Dynamo,代码行数:7,代码来源:dynFunction.cs

示例12: WriteOutInhibition

    private void WriteOutInhibition(XmlDocument xml, XmlElement session)
    {
        XmlElement dots = xml.CreateElement("dots");

        XmlElement ldot = xml.CreateElement("Left");

        Vector2 dotPos = new Vector2(Screen.width/4f,Screen.height/2f);

        ldot.SetAttribute("Center", dotPos.ToString());

        dots.AppendChild(ldot);

        XmlElement rdot = xml.CreateElement("Right");

        dotPos = new Vector2(Screen.width*.75f,Screen.height/2f);

        rdot.SetAttribute("Center", dotPos.ToString());

        dots.AppendChild(rdot);
        session.AppendChild(dots);
        XmlElement practice = xml.CreateElement("practice");

        //Loop through all the events and write them out
        foreach(InhibitionEvent eS in gm.Practice){
            if(eS.Completed){
                XmlElement trial = xml.CreateElement("trial");

                    if(eS.DotColor =="yellow")
                        trial.SetAttribute("TargetSide", "same");
                    else
                        trial.SetAttribute("TargetSide", "opposite");

                    trial.SetAttribute("TimedOut", eS.TimedOut.ToString());

                    if(eS.Response!=null){
                        trial.SetAttribute("ResponseTime", eS.Response.ResponseTime.ToString());
                        trial.SetAttribute("TouchPosition", eS.Response.TouchLocation.ToString());
                        trial.SetAttribute("DistanceFromCenter",eS.Response.DistanceFromCenter.ToString());

                        if(eS.Response.DotPressed ==1)
                            trial.SetAttribute("PressedSide","right");
                        else
                            trial.SetAttribute("PressedSide","left");
                    }

                    if(eS.respondedCorrectly())
                        trial.SetAttribute("Correct","1");
                    else
                        trial.SetAttribute("Correct","0");
                practice.AppendChild(trial);
            }
        }

        session.AppendChild(practice);

        //Create the trial cluster
        XmlElement trials = xml.CreateElement("trials");

        //Loop through all the events and write them out
        foreach(InhibitionEvent eS in gm.Events){
            if(eS.Completed){
                XmlElement trial = xml.CreateElement("trial");

                    if(eS.DotColor =="yellow") trial.SetAttribute("TargetSide", "same");
                    else trial.SetAttribute("TargetSide", "opposite");

                    trial.SetAttribute("TimedOut", eS.TimedOut.ToString());

                    if(eS.Response!=null){
                        trial.SetAttribute("ResponseTime", eS.Response.ResponseTime.ToString());
                        trial.SetAttribute("TouchPosition", eS.Response.TouchLocation.ToString());
                        trial.SetAttribute("DistanceFromCenter",eS.Response.DistanceFromCenter.ToString());

                        if(eS.Response.DotPressed ==1) trial.SetAttribute("PressedSide","right");
                        else trial.SetAttribute("PressedSide","left");
                    }

                    if(eS.respondedCorrectly()) trial.SetAttribute("Correct","1");
                    else trial.SetAttribute("Correct","0");

                trials.AppendChild(trial);
            }
        }
        session.AppendChild(trials);
    }
开发者ID:NeuroScouting,项目名称:YL,代码行数:85,代码来源:XmlManager.cs

示例13: WriteOutImplicit

    private void WriteOutImplicit(XmlDocument xml, XmlElement session)
    {
        XmlElement practice = xml.CreateElement("practice");
        float avgTime=0;
        float avgDist=0;
        float responseCount=0;

        //Loop through all the events and write them out
        foreach(ImplicitEvent eS in gm.Practice){
            if(eS.Completed){
                XmlElement trial = xml.CreateElement("event");

                if(eS.Response==null){
                    trial.SetAttribute("Correct", "false");
                }
                else{
                    trial.SetAttribute("Correct", "true");
                    responseCount++;
                    avgTime += eS.Response.ResponseTime;
                    avgDist += eS.Response.DistanceFromCenter;
                    trial.SetAttribute("ResponseTime", eS.Response.ResponseTime.ToString());
                    trial.SetAttribute("TouchPosition", eS.Response.TouchLocation.ToString());
                    trial.SetAttribute("DistanceFromCenter", eS.Response.DistanceFromCenter.ToString());
                }

                practice.AppendChild(trial);
            }
        }

        avgTime= avgTime / (responseCount==0? 1 : responseCount);
        avgDist = avgDist / (responseCount==0? 1 : responseCount);
        responseCount = responseCount / gm.Practice.Count;

        practice.SetAttribute("PercentCorrect", responseCount.ToString());
        practice.SetAttribute("AvgDistanceFromCenter", avgDist.ToString());
        practice.SetAttribute("AvgResponseTime", avgTime.ToString());

        session.AppendChild(practice);

        XmlElement blocks = xml.CreateElement("blocks");

        List<List<ImplicitEvent>> b = new List<List<ImplicitEvent>>();

        b.Add(new List<ImplicitEvent>());

        int blockInt=0;

        //Shift out the event
        foreach(ImplicitEvent iE in gm.Events){
            if(b[blockInt].Count == 0)
                b[blockInt].Add(iE);
            else{
                if(iE.BlockNum != b[blockInt][0].BlockNum){
                    b.Add(new List<ImplicitEvent>());
                    blockInt++;
                }

                b[blockInt].Add(iE);
            }
        }

        foreach(List<ImplicitEvent> iEs in b){

            avgTime=0;
            avgDist=0;
            responseCount=0;

            //Create the trial cluster
            XmlElement block = xml.CreateElement("block");

            //Loop through all the events and write them out
            foreach(ImplicitEvent iE in iEs){

                if(iE.Completed){
                    XmlElement trial = xml.CreateElement("event");

                    if(iE.Response==null){
                        trial.SetAttribute("Correct", "false");
                    }
                    else{
                        trial.SetAttribute("Correct", "true");
                        responseCount++;
                        avgTime += iE.Response.ResponseTime;
                        avgDist += iE.Response.DistanceFromCenter;
                        trial.SetAttribute("ResponseTime", iE.Response.ResponseTime.ToString());
                        trial.SetAttribute("TouchPosition", iE.Response.TouchLocation.ToString());
                        trial.SetAttribute("DistanceFromCenter", iE.Response.DistanceFromCenter.ToString());
                    }

                    block.AppendChild(trial);
                }
            }

            avgTime= avgTime / (responseCount==0? 1 : responseCount);
            avgDist = avgDist / (responseCount==0? 1 : responseCount);
            responseCount = responseCount / iEs.Count;

            block.SetAttribute("PercentCorrect", responseCount.ToString());
            block.SetAttribute("AvgDistanceFromCenter", avgDist.ToString());
            block.SetAttribute("AvgResponseTime", avgTime.ToString());
//.........这里部分代码省略.........
开发者ID:NeuroScouting,项目名称:YL,代码行数:101,代码来源:XmlManager.cs

示例14: WriteOutAssociate

    private void WriteOutAssociate(XmlDocument xml, XmlElement session)
    {
        XmlElement practice = xml.CreateElement("practice");

        //Loop through all the practice trials
        foreach(AssociateEvent eS in gm.Practice){
            if(eS.Completed){
                XmlElement trial = xml.CreateElement("trial");
                    trial.SetAttribute("NumBadTouches",(eS.Responses.Count-1).ToString());

                    int score = 0;
                    if(eS.Responses.Count>1){
                        int target = eS.TargetImage;

                        if(target<7){
                            if(eS.Responses[0].DotPressed>=7) score =1;
                            else score =2;
                        }
                        else{
                            if(eS.Responses[0].DotPressed>=7) score =2;
                            else score =1;
                        }
                    }

                    trial.SetAttribute("Score",score.ToString());
                practice.AppendChild(trial);
            }
        }

        session.AppendChild(practice);

        //Create the trial cluster
        XmlElement trials = xml.CreateElement("trials");

        float avgBadTouch =0;

        int indexOfLastSpike=-1;

        int index = 0;

        int countOfRightCategory=0;

        int indexOfFiftyPercent=-1;

        float probabilityCorrectTouch = 0;

        //Loop through all the events and write them out
        foreach(AssociateEvent eS in gm.Events){
            if(eS.Completed){
                XmlElement trial = xml.CreateElement("trial");
                trial.SetAttribute("NumBadTouches",(eS.Responses.Count-1).ToString());

                avgBadTouch +=(eS.Responses.Count-1);

                if(index>=1)
                    if(((AssociateEvent)gm.Events[index-1]).Responses.Count<eS.Responses.Count) indexOfLastSpike = index;

                int score = 0;
                if(eS.Responses.Count>1){
                    int target = eS.TargetImage;

                    if(target<7){
                        if(eS.Responses[0].DotPressed>=7) score =1;
                        else score =2;
                    }
                    else{
                        if(eS.Responses[0].DotPressed>=7) score =2;
                        else score =1;
                    }
                }

                trial.SetAttribute("Score",score.ToString());

                if(score<2){
                    countOfRightCategory++;
                }

                probabilityCorrectTouch = ((float)countOfRightCategory)/((float)(index+1));

                if(probabilityCorrectTouch<.5 &&indexOfFiftyPercent !=-1)
                    indexOfFiftyPercent = -1;
                else if(probabilityCorrectTouch>=.5 &&indexOfFiftyPercent ==-1)
                    indexOfFiftyPercent = index;

                trials.AppendChild(trial);
            }
            index++;
        }

        avgBadTouch = avgBadTouch/(float)gm.Events.Count;

        trials.SetAttribute("AvgNumBadTouch", avgBadTouch.ToString());
        trials.SetAttribute("LearningRateItems", (indexOfLastSpike==-1? "NaN" : (indexOfLastSpike+1).ToString()));
        trials.SetAttribute("AvgProbabilityCorrectCategory", Mathf.Round(probabilityCorrectTouch *100).ToString() +"%");
        trials.SetAttribute("LearningRateCategory", indexOfFiftyPercent==-1 ? "NaN" : (indexOfFiftyPercent+1).ToString());

        session.AppendChild(trials);
    }
开发者ID:NeuroScouting,项目名称:YL,代码行数:98,代码来源:XmlManager.cs

示例15: WriteOutStopping

    private void WriteOutStopping(XmlDocument xml, XmlElement session)
    {
        XmlElement practice = xml.CreateElement("practice");
        float avgTime=0;
        float avgDist=0;
        float responseCount=0;
        float blueCount=0;
        float avgCorrectBlue=0;
        float orangeCount=0;
        float avgCorrectOrange=0;
        //float avgTurningTime=0;

        //Loop through all the events and write them out
        foreach(StoppingEvent eS in gm.Practice){

            if(eS.Completed){

                XmlElement trial = xml.CreateElement("event");

                trial.SetAttribute("TurnedOrange", (!eS.Go).ToString());
                //trial.SetAttribute("TurningTime", eS.TurningTime.ToString());

                if(eS.Go) blueCount++;
                else orangeCount++;

                //avgTurningTime += eS.TurningTime;

                if((eS.Response==null && !eS.Go) || (eS.Response!=null && eS.Go)){
                    trial.SetAttribute("Correct", "true");
                    if(eS.Go)
                        avgCorrectBlue++;
                    else{
                        avgCorrectOrange++;
                    }
                }
                else trial.SetAttribute("Correct", "false");

                if(eS.Response!=null ){
                    if(eS.Go){
                        responseCount++;
                        avgTime += eS.Response.ResponseTime;
                        avgDist += eS.Response.DistanceFromCenter;
                    }
                    trial.SetAttribute("ResponseTime", eS.Response.ResponseTime.ToString());
                    trial.SetAttribute("TouchPosition", eS.Response.TouchLocation.ToString());
                    trial.SetAttribute("DistanceFromCenter", eS.Response.DistanceFromCenter.ToString());
                }

                practice.AppendChild(trial);
            }
        }

        practice.SetAttribute("GoPercentCorrect", (avgCorrectBlue/(blueCount==0? 1 : blueCount)).ToString());
        practice.SetAttribute("AvgDistanceFromCenter", (avgDist / (responseCount==0? 1 : responseCount)).ToString());
        practice.SetAttribute("AvgResponseTime", (avgTime / (responseCount==0? 1 : responseCount)).ToString());
        practice.SetAttribute("StopPercentCorrect", (avgCorrectOrange/(orangeCount==0? 1 : orangeCount)).ToString());
        //practice.SetAttribute("AvgTurningTime", (avgTurningTime/(orangeCount==0? 1 : orangeCount)).ToString());

        session.AppendChild(practice);

        //Create the trial cluster
        XmlElement trials = xml.CreateElement("trials");

        avgTime=0;
        avgDist=0;
        responseCount=0;
        blueCount=0;
        avgCorrectBlue=0;
        orangeCount=0;
        avgCorrectOrange=0;
        //avgTurningTime=0;

        //Loop through all the events and write them out
        foreach(StoppingEvent eS in gm.Events){

            if(eS.Completed){

                XmlElement trial = xml.CreateElement("event");

                trial.SetAttribute("TurnedOrange", (!eS.Go).ToString());
                //trial.SetAttribute("TurningTime", eS.TurningTime.ToString());

                if(eS.Go) blueCount++;
                else orangeCount++;

                //avgTurningTime += eS.TurningTime;

                if((eS.Response==null && !eS.Go) || (eS.Response!=null && eS.Go)){
                    trial.SetAttribute("Correct", "true");
                    if(eS.Go)
                        avgCorrectBlue++;
                    else{
                        avgCorrectOrange++;
                    }
                }
                else trial.SetAttribute("Correct", "false");

                if(eS.Response!=null ){
                    if(eS.Go){
                        responseCount++;
//.........这里部分代码省略.........
开发者ID:NeuroScouting,项目名称:YL,代码行数:101,代码来源:XmlManager.cs


注:本文中的XmlElement.AppendChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。