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


C# XmlElement.SelectSingleNode方法代码示例

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


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

示例1: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            conditions = element.SelectNodes("condition");

        string tmpArgVal;

        int x = 0, y = 0, width = 0, height = 0;

        tmpArgVal = element.GetAttribute("x");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            x = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("y");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            y = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("width");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            width = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("height");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            height = int.Parse(tmpArgVal);
        }
        barrier = new Barrier(generateId(), x, y, width, height);

        if (element.SelectSingleNode("documentation") != null)
            barrier.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement ell in conditions)
        {
            currentConditions = new Conditions();
            new ConditionSubParser_(currentConditions, chapter).ParseElement(ell);
            this.barrier.setConditions(currentConditions);
        }

        scene.addBarrier(barrier);
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:43,代码来源:BarrierSubParser_.cs

示例2: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            resourcess = element.SelectNodes("resources"),
            assets,
            conditions,
            textcolors = element.SelectNodes("textcolor"),
            bordercolos,
            frontcolors,
            voices = element.SelectNodes("voice"),
            descriptionss = element.SelectNodes("description");

        string tmpArgVal;

        player = new Player();
        descriptions = new List<Description>();
        player.setDescriptions(descriptions);

        if (element.SelectSingleNode("documentation") != null)
            player.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement el in resourcess)
        {
            currentResources = new ResourcesUni();
            tmpArgVal = el.GetAttribute("name");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                currentResources.setName(el.GetAttribute(tmpArgVal));
            }

            assets = el.SelectNodes("asset");
            foreach (XmlElement ell in assets)
            {
                string type = "";
                string path = "";

                tmpArgVal = ell.GetAttribute("type");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    type = tmpArgVal;
                }
                tmpArgVal = ell.GetAttribute("uri");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    path = tmpArgVal;
                }
                currentResources.addAsset(type, path);
            }

            conditions = el.SelectNodes("condition");
            foreach (XmlElement ell in conditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell);
                currentResources.setConditions(currentConditions);
            }

            player.addResources(currentResources);
        }

        foreach (XmlElement el in textcolors)
        {
            tmpArgVal = el.GetAttribute("showsSpeechBubble");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                player.setShowsSpeechBubbles(tmpArgVal.Equals("yes"));
            }

            tmpArgVal = el.GetAttribute("bubbleBkgColor");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                player.setBubbleBkgColor(tmpArgVal);
            }

            tmpArgVal = el.GetAttribute("bubbleBorderColor");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                player.setBubbleBorderColor(tmpArgVal);
            }

            frontcolors = element.SelectNodes("frontcolor");
            foreach (XmlElement ell in frontcolors)
            {
                string color = "";

                tmpArgVal = ell.GetAttribute("color");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    color = tmpArgVal;
                }

                player.setTextFrontColor(color);
            }

            bordercolos = element.SelectNodes("bordercolor");
            foreach (XmlElement ell in bordercolos)
            {
                string color = "";

                tmpArgVal = el.GetAttribute("color");
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:PlayerSubParser_.cs

示例3: MergeCell

 /// <summary>
 /// 合并单元格(只考虑了行合并)
 /// </summary>
 /// <param name="xeTemplate">Worksheet表格</param>
 private void MergeCell(XmlElement xeTemplate)
 {
     foreach (DataTable tab in this.dataSource.Tables)
     {
         if (!this.printInfoList.ContainsKey(tab.TableName))
             continue;
         PrintInfo pinfo = this.printInfoList[tab.TableName];
         foreach (DataColumn col in tab.Columns)
         {
             if (null == col.ExtendedProperties["merge"] || "是" != Convert.ToString(col.ExtendedProperties["merge"]))
                 continue;
             int rowCount = 0;
             //查找指定单元格
             string strFind = ".//ss:Data[@field='{0}' and (not(@alias) or @alias='{1}')]";
             strFind = string.Format(strFind, col.ColumnName, pinfo.AliasName);
             //查找后续单元格
             string strFind2 = "following-sibling::ss:Row//ss:Data[@field='{0}' and (not(@alias) or @alias='{1}')]";
             strFind2 = string.Format(strFind2, col.ColumnName, pinfo.AliasName);
             XmlElement xeData = xeTemplate.SelectSingleNode(strFind,this.xmlNsMgl) as XmlElement ;
             while (null != xeData)
             {
                 string colIndex = xeData.ParentNode.Attributes["c"].Value;
                 XmlElement xeRow = xeData.ParentNode.ParentNode as XmlElement;
                 if (string.IsNullOrEmpty(xeData.InnerText))
                 {
                     rowCount = 0;
                     xeData = xeRow.SelectSingleNode(strFind2, this.xmlNsMgl) as XmlElement;
                     continue;
                 }
                 //查找下一行同列同字段单元格
                 string strFindNext = "ss:Cell[@c='{0}']/ss:Data[@field='{1}' and (not(@alias) or @alias='{2}')]";
                 strFindNext = string.Format(strFindNext, colIndex, col.ColumnName, pinfo.AliasName);
                 XmlElement xeRowNext = xeRow.NextSibling as XmlElement;
                 XmlElement xeDataNext = xeRowNext.SelectSingleNode(strFindNext,this.xmlNsMgl) as XmlElement;
                 while (null != xeDataNext)
                 {
                     if (xeData.InnerText != xeDataNext.InnerText)
                         break;
                     //邻行同列同值合并单元格
                     rowCount++;
                     XmlElement xeCellNext=xeDataNext.ParentNode as XmlElement;
                     XmlElement xeCellSibling = xeCellNext.NextSibling as XmlElement;
                     if (null != xeCellSibling)
                         xeCellSibling.SetAttribute("Index", this.xmlNsMgl.LookupNamespace("ss"), xeCellSibling.GetAttribute("c"));
                     xeCellNext.ParentNode.RemoveChild(xeCellNext);
                     //下一行
                     xeRowNext = xeRowNext.NextSibling as XmlElement;
                     xeDataNext= xeRowNext.SelectSingleNode(strFindNext,this.xmlNsMgl) as XmlElement;
                 }
                 //邻行同列同值合并单元格
                 if (rowCount > 0)
                     ((XmlElement)xeData.ParentNode).SetAttribute("MergeDown", this.xmlNsMgl.LookupNamespace("ss"), Convert.ToString(rowCount));
                 rowCount = 0;
                 xeData = xeRow.SelectSingleNode(strFind2,this.xmlNsMgl) as XmlElement;
             }
         }
     }
 }
开发者ID:thisisvoa,项目名称:GranityApp2.5,代码行数:62,代码来源:PrintExcel.cs

示例4: GetXMLText

    public string GetXMLText(XmlElement tempXML, string tempPath)
    {
        string tempT = string.Empty;
        XmlNode tempX = null;

        if (tempXML != null)
        {
            tempX = tempXML.SelectSingleNode(tempPath);
            if (tempX != null)
            {
                tempT = tempX.InnerText;
            }
        }
        return tempT;
    }
开发者ID:anirvan,项目名称:ProfilesRNSBeta-OpenSocial,代码行数:15,代码来源:DirectService.aspx.cs

示例5: Node

	public static XmlElement Node(XmlElement node, int index, string name, string attr, string value)
	{
		XmlElement n = (XmlElement)node.SelectSingleNode(name + "[@" + attr + "='" + value + "']");
		if (n != null)
			node.RemoveChild(n);
		else
		{
			n = (XmlElement)node.AppendChild(node.OwnerDocument.CreateElement(name));
			n.Attributes.Append(node.OwnerDocument.CreateAttribute(attr)).Value = value;
		}

		if (index >= node.ChildNodes.Count || node.ChildNodes.Count == 0)
			node.AppendChild(n);
		else
			node.InsertBefore(n, node.ChildNodes[index]);

		return n;
	}
开发者ID:mrscylla,项目名称:volotour.ru,代码行数:18,代码来源:UpdateSystemUpdateFramework.aspx.cs

示例6: SetPageNamespaces

	private void SetPageNamespaces(XmlElement namespaces)
	{
		XmlNode clear = namespaces.SelectSingleNode("clear");
		while (clear != null)
		{
			List<XmlNode> delete = new List<XmlNode>();
			foreach (XmlNode node in namespaces.ChildNodes)
			{
				delete.Add(node);
				if (node == clear)
					break;
			}
			foreach (XmlNode node in delete)
				namespaces.RemoveChild(node);

			clear = namespaces.SelectSingleNode("clear");
		}

		Node(namespaces, 0, "clear");
		Node(namespaces, "add", "namespace", "System");
		Node(namespaces, "add", "namespace", "System.Collections");
		Node(namespaces, "add", "namespace", "System.Collections.Generic");
		Node(namespaces, "add", "namespace", "System.Collections.Specialized");
		Node(namespaces, "add", "namespace", "System.Configuration");
		Node(namespaces, "add", "namespace", "System.Text");
		Node(namespaces, "add", "namespace", "System.Text.RegularExpressions");
		Node(namespaces, "add", "namespace", "System.Linq");
		Node(namespaces, "add", "namespace", "System.Xml.Linq");
		Node(namespaces, "add", "namespace", "System.Web");
		Node(namespaces, "add", "namespace", "System.Web.Caching");
		Node(namespaces, "add", "namespace", "System.Web.SessionState");
		Node(namespaces, "add", "namespace", "System.Web.Security");
		Node(namespaces, "add", "namespace", "System.Web.Profile");
		Node(namespaces, "add", "namespace", "System.Web.UI");
		Node(namespaces, "add", "namespace", "System.Web.UI.WebControls");
		Node(namespaces, "add", "namespace", "System.Web.UI.WebControls.WebParts");
		Node(namespaces, "add", "namespace", "System.Web.UI.HtmlControls");
	}
开发者ID:mrscylla,项目名称:volotour.ru,代码行数:38,代码来源:UpdateSystemUpdateFramework.aspx.cs

示例7: FindNode

	private static XmlElement FindNode(XmlElement node, string name, string suffix)
	{
		return (XmlElement)node.SelectSingleNode(name + suffix, new XContext());
	}
开发者ID:mrscylla,项目名称:volotour.ru,代码行数:4,代码来源:UpdateSystemUpdateFramework.aspx.cs

示例8: DeleteNode

	private static void DeleteNode(XmlElement node, string name, string suffix)
	{
		XmlNode child = node.SelectSingleNode(name + suffix, new XContext());
		if (child != null)
		{
			node.RemoveChild(child);
		}
	}
开发者ID:mrscylla,项目名称:volotour.ru,代码行数:8,代码来源:UpdateSystemUpdateFramework.aspx.cs

示例9: ParseElement

    public override void ParseElement(XmlElement element)
    {
        string tmpArgVal;
        XmlElement tmpXmlEl;

        if (element.SelectSingleNode ("documentation") != null) {
            this.element.setDocumentation (element.SelectSingleNode ("documentation").InnerText);
            element.RemoveChild (element.SelectSingleNode ("documentation"));
        }

        foreach (XmlElement action in element.ChildNodes) {
            //First we parse the elements every action haves:
            tmpArgVal = action.GetAttribute("needsGoTo");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                currentNeedsGoTo = tmpArgVal.Equals("yes");
            }
            tmpArgVal = action.GetAttribute("keepDistance");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                currentKeepDistance = int.Parse(tmpArgVal);
            }
            tmpArgVal = action.GetAttribute("not-effects");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                activateNotEffects = tmpArgVal.Equals("yes");
            }
            tmpArgVal = action.GetAttribute("click-effects");

            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                activateClickEffects = tmpArgVal.Equals("yes");
            }
            tmpArgVal = action.GetAttribute("idTarget");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                currentIdTarget = tmpArgVal;
            }

            currentConditions = new Conditions();
            currentEffects = new Effects();
            currentNotEffects = new Effects();
            currentClickEffects = new Effects();
            tmpXmlEl = (XmlElement) action.SelectSingleNode ("condition");
            if (tmpXmlEl != null)
                new ConditionSubParser_ (currentConditions, chapter).ParseElement (tmpXmlEl);
            tmpXmlEl = (XmlElement) action.SelectSingleNode ("effect");
            if (tmpXmlEl != null)
                new EffectSubParser_ (currentEffects, chapter).ParseElement (tmpXmlEl);

            tmpXmlEl = (XmlElement) action.SelectSingleNode ("click-effect");
            if (tmpXmlEl != null)
                new EffectSubParser_ (currentClickEffects, chapter).ParseElement (tmpXmlEl);

            tmpXmlEl = (XmlElement) action.SelectSingleNode ("not-effect");
            if (tmpXmlEl != null)
                new EffectSubParser_ (currentNotEffects, chapter).ParseElement (tmpXmlEl);

            //Then we instantiate the correct action by name.
            //We also parse the elements that are unique of that action.
            Action currentAction = new Action(0);
            switch (action.Name) {
            case "examines":        currentAction = new Action(Action.EXAMINE, currentConditions, currentEffects, currentNotEffects); break;
            case "grabs":           currentAction = new Action(Action.GRAB, currentConditions, currentEffects, currentNotEffects); break;
            case "use":             currentAction = new Action(Action.USE, currentConditions, currentEffects, currentNotEffects); break;
            case "talk-to":         currentAction = new Action(Action.TALK_TO, currentConditions, currentEffects, currentNotEffects); break;
            case "use-with":        currentAction = new Action(Action.USE_WITH, currentIdTarget, currentConditions, currentEffects, currentNotEffects, currentClickEffects); break;
            case "give-to":         currentAction = new Action(Action.GIVE_TO, currentIdTarget, currentConditions, currentEffects, currentNotEffects, currentClickEffects); break;
            case "drag-to":         currentAction = new Action (Action.DRAG_TO, currentIdTarget, currentConditions, currentEffects, currentNotEffects, currentClickEffects); break;
            case "custom":
            case "custom-interact":
                CustomAction customAction = new CustomAction ((action.Name == "custom") ? Action.CUSTOM : Action.CUSTOM_INTERACT);

                tmpArgVal = action.GetAttribute ("name");
                if (!string.IsNullOrEmpty (tmpArgVal)) {
                    currentName = tmpArgVal;
                }
                customAction.setName (currentName);

                tmpXmlEl = (XmlElement) action.SelectSingleNode ("resources");
                if (tmpXmlEl != null)
                    customAction.addResources (parseResources (tmpXmlEl));

                currentAction = customAction;
                break;
            }

            //Finally we set al the attributes to the action;
            currentAction.setConditions(currentConditions);
            currentAction.setEffects(currentEffects);
            currentAction.setNotEffects(currentNotEffects);
            currentAction.setKeepDistance(currentKeepDistance);
            currentAction.setNeedsGoTo(currentNeedsGoTo);
            currentAction.setActivatedNotEffects(activateNotEffects);
            currentAction.setClickEffects(currentClickEffects);
            currentAction.setActivatedClickEffects(activateClickEffects);

            this.element.addAction(currentAction);
        }

//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:ActionsSubParser_.cs

示例10: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            endsgame = element.SelectNodes("end-game"),
            nextsscene = element.SelectNodes("next-scene"),
            resourcess = element.SelectNodes("resources"),
            descriptionss = element.SelectNodes("description"),
            assets,
            conditions = element.SelectNodes("condition"),
            effects = element.SelectNodes("effect"),
            postseffects = element.SelectNodes("post-effect");

        string tmpArgVal;

        string slidesceneId = "";
        bool initialScene = false;
        string idTarget = "";
        int x = int.MinValue, y = int.MinValue;
        int transitionType = 0, transitionTime = 0;
        string next = "go-back";
        bool canSkip = true;

        tmpArgVal = element.GetAttribute("id");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            slidesceneId = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("start");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            initialScene = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("idTarget");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            idTarget = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("destinyX");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            x = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("destinyY");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            y = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("transitionType");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            transitionType = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("transitionTime");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            transitionTime = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("next");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            next = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("canSkip");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            canSkip = tmpArgVal.Equals("yes");
        }
        if (element.Name.Equals("slidescene"))
            cutscene = new Slidescene(slidesceneId);
        else
            cutscene = new Videoscene(slidesceneId);
        if (initialScene)
            chapter.setTargetId(slidesceneId);

        cutscene.setTargetId(idTarget);
        cutscene.setPositionX(x);
        cutscene.setPositionY(y);
        cutscene.setTransitionType((NextSceneEnumTransitionType) transitionType);
        cutscene.setTransitionTime(transitionTime);

        if(element.SelectSingleNode("name")!= null)
             cutscene.setName(element.SelectSingleNode("name").InnerText);
        if (element.SelectSingleNode("documentation") != null)
            cutscene.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement ell in effects)
        {
            currentEffects = new Effects();
            new EffectSubParser_(currentEffects, chapter).ParseElement(ell);
            cutscene.setEffects(currentEffects);
        }

        if (cutscene is Videoscene)
            ((Videoscene) cutscene).setCanSkip(canSkip);

        if (next.Equals("go-back"))
        {
            cutscene.setNext(Cutscene.GOBACK);
        }
        else if (next.Equals("new-scene"))
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:CutsceneSubParser_.cs

示例11: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            initscondition = element.SelectNodes("init-condition"),
            endscondition = element.SelectNodes("end-condition"),
            effects = element.SelectNodes("effect"),
            postseffect = element.SelectNodes("post-effect");

        string tmpArgVal;

        string time = "";
        bool usesEndCondition = true;
        bool runsInLoop = true;
        bool multipleStarts = true;
        bool countDown = false, showWhenStopped = false, showTime = false;
        string displayName = "timer";

        tmpArgVal = element.GetAttribute("time");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            time = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("usesEndCondition");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            usesEndCondition = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("runsInLoop");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            runsInLoop = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("multipleStarts");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            multipleStarts = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("showTime");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            showTime = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("displayName");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            displayName = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("countDown");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            countDown = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("showWhenStopped");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            showWhenStopped = tmpArgVal.Equals("yes");
        }

        timer = new Timer(long.Parse(time));
        timer.setRunsInLoop(runsInLoop);
        timer.setUsesEndCondition(usesEndCondition);
        timer.setMultipleStarts(multipleStarts);
        timer.setShowTime(showTime);
        timer.setDisplayName(displayName);
        timer.setCountDown(countDown);
        timer.setShowWhenStopped(showWhenStopped);

        if (element.SelectSingleNode("documentation") != null)
            timer.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement el in initscondition)
        {
            currentConditions = new Conditions();
            new ConditionSubParser_(currentConditions, chapter).ParseElement(el);
            timer.setInitCond(currentConditions);
        }

        foreach (XmlElement el in endscondition)
        {
            currentConditions = new Conditions();
            new ConditionSubParser_(currentConditions, chapter).ParseElement(el);
            timer.setEndCond(currentConditions);
        }

        foreach (XmlElement el in effects)
        {
            currentEffects = new Effects();
            new EffectSubParser_(currentEffects, chapter).ParseElement(el);
            timer.setEffects(currentEffects);
        }

        foreach (XmlElement el in postseffect)
        {
            currentEffects = new Effects();
            new EffectSubParser_(currentEffects, chapter).ParseElement(el);
            timer.setPostEffects(currentEffects);
        }

        chapter.addTimer(timer);
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:100,代码来源:TimerSubParser_.cs

示例12: Init

        /// <summary>
        /// This method will populate a user based on the XML input into it
        /// </summary>
        /// <param name="Element">Represents the XML data returned for a user</param>
        private void Init(XmlElement Element)
        {

            //Add values from returned payload to the object properies
            this.Provider = Element.SelectSingleNode("/rsp/profile/providerName").InnerText.ToString();
            this.UserName = Element.SelectSingleNode("/rsp/profile/displayName").InnerText.ToString();
            this.Identifier = Element.SelectSingleNode("/rsp/profile/identifier").InnerText.ToString();
            if (this.Provider == "Google")
            {
                this.Email = Element.SelectSingleNode("/rsp/profile/email").InnerText.ToString();
                this.FirstName = Element.SelectSingleNode("/rsp/profile/name/givenName").InnerText.ToString();
                this.LastName = Element.SelectSingleNode("/rsp/profile/name/familyName").InnerText.ToString();
                this.Photo = null;
            }
            else if (this.Provider == "Yahoo!")
            {
                //Need to split up the "formatted" name to give us FirstName and LastName values
                string[] temp = Element.SelectSingleNode("/rsp/profile/name/formatted").InnerText.ToString().Split(' ');
                this.Email = Element.SelectSingleNode("/rsp/profile/email").InnerText.ToString();
                this.FirstName = temp[0];
                this.LastName = temp[1];
                this.Photo = Element.SelectSingleNode("/rsp/profile/photo").InnerText.ToString();
            }
            else if (this.Provider == "Facebook")
            {
                this.Email = Element.SelectSingleNode("/rsp/profile/email").InnerText.ToString();
                this.FirstName = Element.SelectSingleNode("/rsp/profile/name/givenName").InnerText.ToString();
                this.LastName = Element.SelectSingleNode("/rsp/profile/name/familyName").InnerText.ToString();
                this.Photo = Element.SelectSingleNode("/rsp/profile/photo").InnerText.ToString();
                this.ProviderAccessToken = Element.SelectSingleNode("/rsp/profile/accessCredentials/accessToken").InnerText.ToString();
            }
            else if (this.Provider == "Twitter")
            {
                //Need to split up the "formatted" name to give us FirstName and LastName values
                string[] temp = Element.SelectSingleNode("/rsp/profile/name/formatted").InnerText.ToString().Split(' ');
                this.FirstName = temp[0];
                this.LastName = temp[1];
                this.ProviderAccessToken = Element.SelectSingleNode("/rsp/profile/accessCredentials/oauthToken").InnerText.ToString();
            }
            else if (this.Provider == "LinkedIn")
            {
                //Need to split up the "formatted" name to give us FirstName and LastName values
                string[] temp = Element.SelectSingleNode("/rsp/profile/name/formatted").InnerText.ToString().Split(' ');
                this.FirstName = temp[0];
                this.LastName = temp[1];
                this.Photo = Element.SelectSingleNode("/rsp/profile/photo").InnerText.ToString();

            }
        }
开发者ID:joehanz74,项目名称:Janrain-Sample-Code,代码行数:53,代码来源:engage.cs

示例13: GetXMLText

 public string GetXMLText(XmlElement tempXML, string tempPath)
 {
     string tempT = "";
         if (tempXML != null)
         {
             XmlNode tempX;
             tempX = tempXML.SelectSingleNode(tempPath);
             if (tempX != null)
                 tempT = tempX.InnerText;
         }
         return tempT;
 }
开发者ID:CTSIatUCSF,项目名称:ProfilesRNSBeta-OpenSocial,代码行数:12,代码来源:Direct.aspx.cs

示例14: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            points = element.SelectNodes("point"),
            descriptionss = element.SelectNodes("description"),
            actionss = element.SelectNodes("actions"),
            conditions = element.SelectNodes("condition");
            //,
              //effects = element.SelectNodes("effect");

        string tmpArgVal;

        int x = 0, y = 0, width = 0, height = 0;
        string id = null;
        bool rectangular = true;
        int influenceX = 0, influenceY = 0, influenceWidth = 0, influenceHeight = 0;
        bool hasInfluence = false;

        tmpArgVal = element.GetAttribute("rectangular");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            rectangular = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("x");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            x = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("y");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            y = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("width");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            width = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("height");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            height = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("id");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            id = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("hasInfluenceArea");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            hasInfluence = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("influenceX");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            influenceX = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("influenceY");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            influenceY = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("influenceWidth");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            influenceWidth = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("influenceHeight");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            influenceHeight = int.Parse(tmpArgVal);
        }

        activeArea = new ActiveArea((id == null ? generateId() : id), rectangular, x, y, width, height);
        if (hasInfluence)
        {
            InfluenceArea influenceArea = new InfluenceArea(influenceX, influenceY, influenceWidth, influenceHeight);
            activeArea.setInfluenceArea(influenceArea);
        }

        if (element.SelectSingleNode("documentation") != null)
            activeArea.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        descriptions = new List<Description>();
        activeArea.setDescriptions(descriptions);

        foreach (XmlElement el in descriptionss)
        {
            description = new Description();
            new DescriptionsSubParser_(description, chapter).ParseElement(el);
            this.descriptions.Add(description);
        }

        foreach (XmlElement el in points)
        {
            if (activeArea != null)
            {
                int x_ = 0, y_ = 0;

//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:ActiveAreaSubParser_.cs

示例15: SetConfigSections

	private static void SetConfigSections(XmlElement configSections)
	{
		XmlElement t;

		XmlNode oldSections = configSections.SelectSingleNode("sectionGroup[@name='system.web.extensions' and contains(lower-case(string(@type)), 'version=1.0.61025.0')]",  new XContext());
		if (oldSections != null)
			configSections.RemoveChild(oldSections);


		t = Node(configSections, "sectionGroup", "name", "system.web.extensions");
		Set(t, "type", "System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");

		XmlElement scripting = Node(t, "sectionGroup", "name", "scripting");
		Set(scripting, "type", "System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");

		t = Node(scripting, "section", "name", "scriptResourceHandler");
		Set(t, "type", "System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
		Set(t, "requirePermission", "false");
		Set(t, "allowDefinition", "MachineToApplication");

		XmlElement webServices = Node(scripting, "sectionGroup", "name", "webServices");
		Set(webServices, "type", "System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");

		t = Node(webServices, "section", "name", "jsonSerialization");
		Set(t, "type", "System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
		Set(t, "requirePermission", "false");
		Set(t, "allowDefinition", "Everywhere");

		t = Node(webServices, "section", "name", "profileService");
		Set(t, "type", "System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
		Set(t, "requirePermission", "false");
		Set(t, "allowDefinition", "MachineToApplication");

		t = Node(webServices, "section", "name", "authenticationService");
		Set(t, "type", "System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
		Set(t, "requirePermission", "false");
		Set(t, "allowDefinition", "MachineToApplication");

		t = Node(webServices, "section", "name", "roleService");
		Set(t, "type", "System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
		Set(t, "requirePermission", "false");
		Set(t, "allowDefinition", "MachineToApplication");
	}
开发者ID:mrscylla,项目名称:volotour.ru,代码行数:43,代码来源:UpdateSystemUpdateFramework.aspx.cs


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