本文整理汇总了C#中XmlNode类的典型用法代码示例。如果您正苦于以下问题:C# XmlNode类的具体用法?C# XmlNode怎么用?C# XmlNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlNode类属于命名空间,在下文中一共展示了XmlNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RunFileAction
private static bool RunFileAction (XmlNode fileElement)
{
string path = GetAttribute (fileElement, "Path");
XmlDocument doc = new XmlDocument ();
try {
doc.Load (path);
} catch {
Console.WriteLine ("ERROR: Could not open {0}.", path);
return false;
}
Console.WriteLine ("Processing {0}...", path);
foreach (XmlNode element in fileElement.SelectNodes ("Replace"))
if (!ReplaceNode (fileElement.OwnerDocument, doc, element))
return false;
foreach (XmlNode element in fileElement.SelectNodes ("Insert"))
if (!InsertNode (fileElement.OwnerDocument, doc, element))
return false;
foreach (XmlNode element in fileElement.SelectNodes ("Remove"))
if (!RemoveNodes (doc, element))
return false;
doc.Save (path);
Console.WriteLine ("{0} saved.", path);
return true;
}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:29,代码来源:XmlInjector.cs
示例2: SiteDocumentBase
protected SiteDocumentBase(XmlNode xmlNode)
{
this.Name = xmlNode.Attributes["name"].Value;
this.Id = xmlNode.Attributes["id"].Value;
//Note: [2015-10-28] Datasources presently don't return this information
// this.ContentUrl = xmlNode.Attributes["contentUrl"].Value;
//Namespace for XPath queries
var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
//Get the project attributes
var projectNode = xmlNode.SelectSingleNode("iwsOnline:project", nsManager);
this.ProjectId = projectNode.Attributes["id"].Value;
this.ProjectName = projectNode.Attributes["name"].Value;
//Get the owner attributes
var ownerNode = xmlNode.SelectSingleNode("iwsOnline:owner", nsManager);
this.OwnerId = ownerNode.Attributes["id"].Value;
//See if there are tags
var tagsNode = xmlNode.SelectSingleNode("iwsOnline:tags", nsManager);
if (tagsNode != null)
{
this.TagsSet = new SiteTagsSet(tagsNode);
}
}
开发者ID:devbhosale,项目名称:TabMigrate,代码行数:27,代码来源:SiteDocumentBase.cs
示例3: Load
public override void Load(XmlNode xnode)
{
type = LocalType.Get(xnode.Name);
texture = new Texture();
name = MyXml.GetString(xnode, "name");
variations = MyXml.GetInt(xnode, "variations", 1);
maxHP = MyXml.GetInt(xnode, "hp");
damage = MyXml.GetInt(xnode, "damage");
attack = MyXml.GetInt(xnode, "attack");
defence = MyXml.GetInt(xnode, "defence");
armor = MyXml.GetInt(xnode, "armor");
movementTime = MyXml.GetFloat(xnode, "movementTime");
attackTime = MyXml.GetFloat(xnode, "attackTime");
isWalkable = MyXml.GetBool(xnode, "walkable");
isFlat = MyXml.GetBool(xnode, "flat");
if (xnode.Name == "Thing") isWalkable = true;
string s = MyXml.GetString(xnode, "type");
if (s != "") creatureType = CreatureType.Get(s);
s = MyXml.GetString(xnode, "corpse");
if (creatureType != null && (creatureType.name == "Animal" || creatureType.name == "Sentient")) s = "Blood";
if (s != "") corpse = Get(s);
s = MyXml.GetString(xnode, "onDeath");
if (creatureType != null && creatureType.name == "Animal") s = "Large Chunk of Meat";
if (s != "") onDeath = ItemShape.Get(s);
for (xnode = xnode.FirstChild; xnode != null; xnode = xnode.NextSibling)
abilities.Add(BigBase.Instance.abilities.Get(MyXml.GetString(xnode, "name")));
}
开发者ID:mxgmn,项目名称:GENW,代码行数:33,代码来源:LocalShape.cs
示例4: ReadFromXMLNode
public virtual void ReadFromXMLNode(XmlNode node)
{
try
{
// Read the pylons models
XmlNodeList cableStates = node.SelectNodes(ModelXMLDefinition.CableState);
foreach (XmlNode cableState in cableStates)
{
CCableState normalNode = new CCableState(this, new CCablingConnectionIndicator(new CLineTwoPointsIndicatorsImpl()));
normalNode.ReadFromXMLNode(cableState);
}
//// Set active cable state to the first one if it exists
//if (CableStates != null && CableStates.Count != 0)
//{
// ActiveCableState = CableStates[0];
//}
// Read the cable switch condition
XmlNode cableConditionNode = node.SelectSingleNode(ModelXMLDefinition.CableSwitchCondition);
if (cableConditionNode != null)
{
m_cableSwitchCondition = CCableSwitchConditionFactory.ReadFromXMLNode(cableConditionNode, this);
}
}
catch (SystemException ex)
{
string errMsg = "Read cable data failed:\n" + ex.Message + "\n" + ex.StackTrace;
vtk.vtkOutputWindow.GetInstance().DisplayErrorText(errMsg);
throw;
}
}
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:32,代码来源:cableModels.cs
示例5: GameInformation
public GameInformation(XmlNode node)
{
if (node ["Title"] != null)
gameName = node ["Title"].InnerText;
if (node ["Description"] != null)
description = node ["Description"].InnerText;
if (node ["LongDescription"] != null)
longDescription = node ["LongDescription"].InnerText;
if (node ["FileLocation"] != null)
programLocation = node ["FileLocation"].InnerText;
if (node ["Arguments"] != null)
arguments = node ["Arguments"].InnerText;
if (node ["Website"] != null)
website = node ["Website"].InnerText;
if (node ["CreationDate"] != null)
releaseDate = node ["CreationDate"].InnerText;
if (node ["NumberOfPlayers"] != null)
requiredPlayers = int.Parse (node ["NumberOfPlayers"].InnerText);
if (node ["Authors"] != null) {
XmlNodeList aths = node ["Authors"].GetElementsByTagName ("Author");
authors = new string[aths.Count];
for (int i = 0; i < aths.Count; i++) {
authors [i] = aths [i].InnerText;
}
}
if (node ["ImageLocation"] != null) {
imagePath = "file://" + Application.dataPath + node ["ImageLocation"].InnerText;
}
}
开发者ID:Cidolfas,项目名称:Arcade-Launcher,代码行数:31,代码来源:GameInformation.cs
示例6: DesignationData
public DesignationData( XmlNode node)
{
try
{
SetValue( ref id, node, "SubTitle_ID");
SetValue( ref eType, node, "SubTitle_Type");
SetValue( ref eCategory, node, "SubTitle_Category");
SetValue( ref name, node, "SubTitle_Name");
SetValue( ref nameColor, node, "SubTitle_Color");
SetValue( ref desc, node, "SubTitle_Description1");
SetValue( ref effectDesc, node, "SubTitle_Description2");
SetValue( ref notice, node, "SubTitle_Notice");
SetValue( ref rankPoint, node, "SubTitle_RankPoint");
SetValue( ref DivineKnight_Item_ID, node, "DivineKnight_Item_ID");
SetValue( ref DivineKnight_Item_Count, node, "DivineKnight_Item_Count");
SetValue( ref Magician_Item_ID, node, "Magician_Item_ID");
SetValue( ref Magician_Item_Count, node, "Magician_Item_Count");
SetValue( ref Cleric_Item_ID, node, "Cleric_Item_ID");
SetValue( ref Cleric_Item_Count, node, "Cleric_Item_Count");
SetValue( ref Hunter_Item_ID, node, "Hunter_Item_ID");
SetValue( ref Hunter_Item_Count, node, "Hunter_Item_Count");
}
catch( System.Exception e)
{
Debug.LogError(e);
}
}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:28,代码来源:AsDesignationManager.cs
示例7: DialogResponse
public DialogResponse(XmlNode xnode)
{
text = MyXml.GetString(xnode, "text");
action = MyXml.GetString(xnode, "action");
jump = MyXml.GetString(xnode, "jump");
condition = MyXml.GetString(xnode, "condition");
}
开发者ID:mxgmn,项目名称:GENW,代码行数:7,代码来源:Dialog.cs
示例8: GetName
public static Name GetName(XmlNode node)
{
string first_name = GetField (node, "t:name/t:first-name");
string last_name = GetField (node, "t:name/t:last-name");
return new Name (first_name, last_name);
}
开发者ID:AveProjVstm,项目名称:MonoVstm,代码行数:7,代码来源:render-team-page.cs
示例9: Level
public Level(XmlNode data)
{
this.data = data;
target = data.FindSkills().First();
level = data.GetInt();
xp = data.Child(XP).GetFloat();
}
开发者ID:foxor,项目名称:unity-nls,代码行数:7,代码来源:SkillSheet.cs
示例10: Parse
public static bool Parse( /*in*/ XmlNode _TableNode ,
out InterpolateTable _Result )
{
InterpolatePair anewPair = null ;
_Result = new InterpolateTable() ;
if( null != _TableNode.Attributes[ "name" ] )
{
_Result.m_Name =_TableNode.Attributes[ "name" ].Value ;
if( _TableNode.HasChildNodes )
{
for( int i = 0 ; i < _TableNode.ChildNodes.Count ; ++i )
{
if( "InterpolatePair" == _TableNode.ChildNodes[ i ].Name )
{
if( true == XMLParseInterpolatePair.Parse( _TableNode.ChildNodes[ i ] ,
out anewPair ) )
{
_Result.m_Table.Add( anewPair ) ;
}
}
}
}
return true ;
}
return false ;
}
开发者ID:NDark,项目名称:KobayashiMaruCommanderOS,代码行数:26,代码来源:XMLParseInterpolateTable.cs
示例11: SerializedObjectNode
/// <summary>
/// Creates a serialized object from an XmlNode that is the child of a parent node
/// </summary>
/// <param name="node">The xml node that this serialized object is wrapping</param>
/// <param name="parentNode">The parent node that we are a part of</param>
protected SerializedObjectNode(XmlNode node, SerializedObjectNode parentNode)
{
m_xmlNode = node;
m_parentNode = parentNode;
if (m_xmlNode.Attributes != null)
{
XmlAttribute versionAttribute = m_xmlNode.Attributes["version"];
if (versionAttribute != null)
{
string fullVersionString = versionAttribute.Value;
while (!string.IsNullOrEmpty(fullVersionString))
{
int versionNameDelimiterIndex = fullVersionString.IndexOf(',');
string versionName = versionNameDelimiterIndex < 0 ? fullVersionString : fullVersionString.Substring(0, versionNameDelimiterIndex);
if (versionNameDelimiterIndex > -1)
fullVersionString = fullVersionString.Substring(versionNameDelimiterIndex + 1);
else
fullVersionString = null;
SerializedVersionInfo newVersionInfo = SerializedVersionInfo.Parse(versionName);
m_versionInfo.AddFirst(newVersionInfo);
}
}
}
foreach (XmlNode childNode in m_xmlNode.ChildNodes)
{
SerializedObjectNode newChildNode = new SerializedObjectNode(childNode, this);
m_children.Add(childNode.Name, newChildNode);
}
}
开发者ID:Awesome-MQP,项目名称:Storybook,代码行数:39,代码来源:SerializedObjectNode.cs
示例12: GetXmlAttrIntss
public static List<List<int>> GetXmlAttrIntss(XmlNode node, string key)
{
//Debug.Log(key);
int num = 0;
List<List<int>> result = new List<List<int>>();
string str = node.Attributes[key].InnerText;
if (!string.IsNullOrEmpty(str))
{
string[] strs = str.Split(',');
foreach (string item in strs)
{
List<int> r = new List<int>();
string[] items = item.Split('|');
foreach (string s in items)
{
if (int.TryParse(s, out num))
{
r.Add(num);
}
}
result.Add(r);
}
}
return result;
}
开发者ID:webconfig,项目名称:Design,代码行数:25,代码来源:Skill_Manager.cs
示例13: xmlToVo
public override void xmlToVo(XmlNode node)
{
XmlElement xmlelement = (XmlElement)node;
id = int.Parse(xmlelement.GetAttribute("id"));
name = xmlelement.GetAttribute("name");
age = int.Parse(xmlelement.GetAttribute("age"));
}
开发者ID:xqy,项目名称:game,代码行数:7,代码来源:BbbWwwDBVO.cs
示例14: loadMedium
/*!
\brief This function create a new Medium based on the information in the given XML Node
\param node The XmlNode to load.
\return Return the new Medium
*/
public Medium loadMedium(XmlNode node)
{
Medium medium = new Medium();
foreach (XmlNode attr in node)
{
switch (attr.Name)
{
case "Id":
medium.setId(Convert.ToInt32(attr.InnerText));
break;
case "Name":
medium.setName(attr.InnerText);
break;
case "Energy":
loadEnergy(attr.InnerText, medium);
break;
case "EnergyProductionRate":
loadEnergyProductionRate(attr.InnerText, medium);
break;
case "MaxEnergy":
loadMaxEnergy(attr.InnerText, medium);
break;
case "ReactionsSet":
medium.setReactionsSet(attr.InnerText);
break;
case "MoleculesSet":
medium.setMoleculesSet(attr.InnerText);
break;
}
}
return medium;
}
开发者ID:quito,项目名称:DSynBio_reloaded,代码行数:38,代码来源:MediumLoader.cs
示例15: FromXMLVector2
public static Vector2 FromXMLVector2(XmlNode node)
{
Vector2 output = new Vector3();
output.x = float.Parse(node["x"].FirstChild.Value);
output.y = float.Parse(node["y"].FirstChild.Value);
return output;
}
开发者ID:onewheelstudio,项目名称:FTF,代码行数:7,代码来源:XMLVariableConverter.cs
示例16: loadInstantReactions
public bool loadInstantReactions(XmlNode node, LinkedList<IReaction> reactions)
{
XmlNodeList IReactionsList = node.SelectNodes("instantReaction");
bool b = true;
foreach (XmlNode IReaction in IReactionsList)
{
InstantReaction ir = new InstantReaction();
foreach (XmlNode attr in IReaction)
{
switch (attr.Name)
{
case "name":
ir.setName(attr.InnerText);
break;
case "reactants":
loadInstantReactionReactants(attr, ir);
break;
case "products":
loadInstantReactionProducts(attr, ir);
break;
}
}
reactions.AddLast(ir);
}
return b;
}
开发者ID:CyberCRI,项目名称:DsynBio,代码行数:27,代码来源:InstantReactionLoader.cs
示例17: Import
/// <summary>
/// Import atlasData from sparrow xml
/// </summary>
protected override OTAtlasData[] Import()
{
if (!ValidXML())
return new OTAtlasData[] { };
List<OTAtlasData> data = new List<OTAtlasData>();
if (xml.DocumentElement.Name == "TextureAtlas")
{
XmlNodeList subTextures = xml.DocumentElement.SelectNodes("SubTexture");
for (int si = 0; si < subTextures.Count; si++)
{
subTexture = subTextures[si];
OTAtlasData ad = new OTAtlasData();
ad.name = S("name");
ad.position = new Vector2(I("x"), I("y"));
ad.size = new Vector2(I("width"), I("height"));
ad.frameSize = new Vector2(I("frameWidth"), I("frameHeight"));
ad.offset = new Vector2(I("frameX"), I("frameY")) * -1;
data.Add(ad);
}
}
return data.ToArray();
}
开发者ID:haruncalayer,项目名称:hotfix,代码行数:28,代码来源:OTSpriteAtlasSparrow.cs
示例18: loadInstantReactionProducts
private bool loadInstantReactionProducts(XmlNode node, InstantReaction ir)
{
foreach (XmlNode attr in node)
if (attr.Name == "product")
loadInstantReactionProduct(attr, ir);
return true;
}
开发者ID:CyberCRI,项目名称:DsynBio,代码行数:7,代码来源:InstantReactionLoader.cs
示例19: InjectXmlString
public void InjectXmlString(string source)
{
//Debug.Log("InjectXmlString :"+source);
xmlNode = DataMakerXmlUtils.StringToXmlNode(source);
RegisterEventHandlers();
}
开发者ID:Daloupe,项目名称:Syzygy_Git,代码行数:7,代码来源:DataMakerXmlProxy.cs
示例20: helper_SetRespositorySite
/// <summary>
/// Ensures the repository Xml Node has the correct site value
/// </summary>
/// <param name="xmlDoc"></param>
/// <param name="xnodeRepository"></param>
/// <param name="serverMapInfo"></param>
private static void helper_SetRespositorySite(XmlDocument xmlDoc, XmlNode xnodeRepository, ITableauServerSiteInfo serverMapInfo)
{
var attrSite = xnodeRepository.Attributes["site"];
//If we have NOT site id, then get rid of the attribute if it exists
var siteId = serverMapInfo.SiteId;
if(string.IsNullOrWhiteSpace(siteId))
{
if(attrSite != null)
{
xnodeRepository.Attributes.Remove(attrSite);
}
return; //Nothing left to do
}
//If the the site attribute is missing, then add it
if (attrSite == null)
{
attrSite = xmlDoc.CreateAttribute("site");
xnodeRepository.Attributes.Append(attrSite);
}
//Set the attribute value
attrSite.Value = siteId;
}
开发者ID:tableau,项目名称:TabMigrate,代码行数:31,代码来源:TwbDataSourceEditor.cs
注:本文中的XmlNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论