本文整理匯總了C#中System.Xml.XmlElement.GetElementsByTagName方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlElement.GetElementsByTagName方法的具體用法?C# XmlElement.GetElementsByTagName怎麽用?C# XmlElement.GetElementsByTagName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.XmlElement
的用法示例。
在下文中一共展示了XmlElement.GetElementsByTagName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Load
public static void Load( XmlElement xml )
{
DisableAll();
if ( xml == null )
return;
foreach( XmlElement el in xml.GetElementsByTagName( "filter" ) )
{
try
{
LocString name = (LocString)Convert.ToInt32( el.GetAttribute( "name" ) );
string enable = el.GetAttribute( "enable" );
for(int i=0;i<m_Filters.Count;i++)
{
Filter f = (Filter)m_Filters[i];
if ( f.Name == name )
{
if ( Convert.ToBoolean( enable ) )
f.OnEnable();
break;
}
}
}
catch
{
}
}
}
示例2: Entry
public Entry(XmlElement element)
{
Id = Util.ChildValue(element, "id");
Title = Util.ChildValue(element, "title");
Link = Util.ChildValue(element, "link");
Published = DateTime.Parse(Util.ChildValue(element, "published"));
Updated = DateTime.Parse(Util.ChildValue(element, "updated"));
User = new User(Util.ChildElement(element, "user"));
Service = new Service(Util.ChildElement(element, "service"));
Comments = new CommentList();
foreach (XmlElement child in element.GetElementsByTagName("comment"))
{
Comments.Add(new Comment(child));
}
Likes = new LikeList();
foreach (XmlElement child in element.GetElementsByTagName("like"))
{
Likes.Add(new Like(child));
}
Media = new MediaList();
foreach (XmlElement child in element.GetElementsByTagName("media"))
{
Media.Add(new Media(child));
}
}
示例3: CitySpawnList
public CitySpawnList(string type, XmlElement xml)
{
m_Type = type;
foreach (XmlElement element in xml.GetElementsByTagName("minions"))
{
foreach (XmlElement obj in element.GetElementsByTagName("object"))
{
Type mobile = null;
if (!Region.ReadType(obj, "type", ref mobile)){
}
m_Minions.Add(mobile);
}
}
foreach (XmlElement element in xml.GetElementsByTagName("captains"))
{
foreach (XmlElement obj in element.GetElementsByTagName("object"))
{
Type mobile = null;
if (!Region.ReadType(obj, "type", ref mobile)){
}
m_Captains.Add(mobile);
}
}
foreach (XmlElement element in xml.GetElementsByTagName("general"))
{
foreach (XmlElement obj in element.GetElementsByTagName("object"))
{
Type mobile = null;
if (!Region.ReadType(obj, "type", ref mobile)){
}
m_General.Add(mobile);
}
}
}
示例4: StatementData
public StatementData(XmlElement xml)
{
AccountNumber = FixmlUtil.ReadString(xml, "Acct");
XmlNodeList fundsXml = xml.GetElementsByTagName("Fund");
XmlNodeList positionsXml = xml.GetElementsByTagName("Position");
Funds = new Dictionary<StatementFundType, decimal>(fundsXml.Count);
Positions = new Dictionary<FixmlInstrument, PosQuantity>(positionsXml.Count);
foreach (XmlElement elem in fundsXml)
{
StatementFundType key;
try { key = StatementFundUtil.Read(elem, "name"); }
catch (FixmlException e) { e.PrintWarning(); continue; }
decimal value = FixmlUtil.ReadDecimal(elem, "value");
Funds.Add(key, value);
}
foreach (XmlElement elem in positionsXml)
{
FixmlInstrument key = FixmlInstrument.FindById(FixmlUtil.ReadString(elem, "Isin"));
int acc110 = FixmlUtil.ReadInt(elem, "Acc110");
int acc120 = FixmlUtil.ReadInt(elem, "Acc120", true) ?? 0;
Positions.Add(key, new PosQuantity(acc110, acc120));
}
// nie zaszkodzi się upewnić - czy to, co NOL3 podesłał, stanowi jakąś integralną całość...
// (i czy ja w ogóle słusznie zakładam, jakie powinny być zależności między tymi wartościami)
// - dla rachunku akcyjnego:
if (CheckFundsSum(StatementFundType.CashReceivables, StatementFundType.Cash, StatementFundType.Receivables))
CheckFundsSum(StatementFundType.PortfolioValue, StatementFundType.CashReceivables, StatementFundType.SecuritiesValue);
// - dla rachunku kontraktowego:
if (CheckFundsSum(StatementFundType.Deposit, StatementFundType.DepositBlocked, StatementFundType.DepositFree))
CheckFundsSum(StatementFundType.PortfolioValue, StatementFundType.Cash, StatementFundType.CashBlocked, StatementFundType.Deposit);
}
示例5: Configure
public void Configure(XmlElement configurationElement)
{
var validatorEl = configurationElement.GetElementsByTagName("validator")
.OfType<XmlElement>().FirstOrDefault(x => x.HasAttribute("type"));
if (validatorEl == null)
{
throw new ConfigurationErrorsException("Missing required validator element for Basic Authentication authentication provider.");
}
var validatorType = Type.GetType(validatorEl.GetAttribute("type"));
if (validatorType == null)
{
throw new ConfigurationErrorsException(String.Format("Cannot resolve validator type '{0}'", validatorEl.GetAttribute("type")));
}
var userValidator = Activator.CreateInstance(validatorType) as IUserValidator;
if (userValidator == null)
{
throw new ConfigurationErrorsException(String.Format("Type {0} does not implement the IUserValidator interface.", validatorType.FullName));
}
if (userValidator is IConfigurableUserValidator)
{
(userValidator as IConfigurableUserValidator).Configure(validatorEl);
}
var realmEl = configurationElement.GetElementsByTagName("realm").OfType<XmlElement>().FirstOrDefault();
var realm = realmEl == null ? "BrightstarDB" : realmEl.InnerText;
_configuration= new BasicAuthenticationConfiguration(userValidator, realm);
}
示例6: GetBin
private Bin GetBin(XmlElement xmlElement, string prefix)
{
XmlNodeList xmlNodeList = xmlElement.GetElementsByTagName(prefix + "Value");
int binValue = -1;
if ((xmlNodeList.Count == 1) && (xmlNodeList.Item(0) is XmlElement))
binValue = Convert.ToInt32((xmlNodeList.Item(0) as XmlElement).InnerText);
xmlNodeList = xmlElement.GetElementsByTagName(prefix + "Good");
bool isGoodDie = false;
if ((xmlNodeList.Count == 1) && (xmlNodeList.Item(0) is XmlElement))
isGoodDie = Convert.ToBoolean((xmlNodeList.Item(0) as XmlElement).InnerText);
xmlNodeList = xmlElement.GetElementsByTagName(prefix + "Reprobed");
bool isReprobedDie = false;
if ((xmlNodeList.Count == 1) && (xmlNodeList.Item(0) is XmlElement))
isReprobedDie = Convert.ToBoolean((xmlNodeList.Item(0) as XmlElement).InnerText);
xmlNodeList = xmlElement.GetElementsByTagName(prefix + "Inked");
bool isInkedDie = false;
if ((xmlNodeList.Count == 1) && (xmlNodeList.Item(0) is XmlElement))
isInkedDie = Convert.ToBoolean((xmlNodeList.Item(0) as XmlElement).InnerText);
if ((binValue >= 0) && (binValue < 256))
return new Bin(binValue, isGoodDie, isReprobedDie, isInkedDie);
return null;
}
示例7: BuildGroupFromXML
private void BuildGroupFromXML(XmlElement xmlElement)
{
try
{
this.GroupEvaluationType =
(GroupEvalType)Enum.Parse(typeof(GroupEvalType),
xmlElement.GetAttribute("Evaluation"));
// Group must have sub-groups and/or conditions
Debug.Assert(xmlElement.HasChildNodes);
// TODO: check names and get them from resource
foreach (XmlNode condition_node in xmlElement.GetElementsByTagName("Condition"))
{
this.conditions.Add(new Condition(condition_node));
}
foreach (XmlNode group_node in xmlElement.GetElementsByTagName("Group"))
{
this.sub_groups.Add(new ConditionGroup(group_node));
}
}
catch
{
// TODO
}
}
示例8: RegistrationSummary
public RegistrationSummary(XmlElement reportElem)
{
this.Complete = reportElem.GetElementsByTagName("complete")[0].InnerText;
this.Success = reportElem.GetElementsByTagName("success")[0].InnerText;
this.TotalTime = reportElem.GetElementsByTagName("totaltime")[0].InnerText;
this.Score = reportElem.GetElementsByTagName("score")[0].InnerText;
}
示例9: fromXML
public static BackgroundItemStruct fromXML(XmlElement element)
{
BackgroundItemStruct str = new BackgroundItemStruct();
str.location = XMLUtil.fromXMLVector2(element.GetElementsByTagName("location")[0]);
str.texturePath = element.GetElementsByTagName("path")[0].FirstChild.Value;
str.rotation = element.GetAttribute("rotation") != "" ? float.Parse(element.GetAttribute("rotation")) : 0f;
str.scale = element.GetAttribute("scale") == "" ? 1f : float.Parse(element.GetAttribute("scale"));
return str;
}
示例10: PostbackInfo
/// <summary>
/// Inflate launch info object from passed in xml element
/// </summary>
/// <param name="launchInfoElem"></param>
/// <param name="postbackInfoElem"></param>
public PostbackInfo(XmlElement postbackInfoElem)
{
this.RegistrationId = postbackInfoElem.GetAttribute("regid");
this.Url = ((XmlElement)postbackInfoElem.GetElementsByTagName("url")[0]).InnerText;
//this.Url = postbackInfoElem.GetAttribute("url");
this.LearnerLogin = ((XmlElement)postbackInfoElem.GetElementsByTagName("login")[0]).InnerText;
this.LearnerPassword = ((XmlElement)postbackInfoElem.GetElementsByTagName("password")[0]).InnerText;
this.RegistrationResultsAuthType = ((XmlElement)postbackInfoElem.GetElementsByTagName("authtype")[0]).InnerText;
}
示例11: Read
public void Read(XmlElement element)
{
this.Name = element.GetElementsByTagName("LevelName")[0].InnerText;
this.Sprites.Clear();
foreach (XmlNode node in element.GetElementsByTagName("Sprites")[0].ChildNodes)
{
this.Sprites.Add(manager.SpriteManager.SpriteFromXML(node));
}
}
示例12: Read
public void Read(XmlElement element)
{
XmlNode dims = element.GetElementsByTagName("Dims")[0];
XmlNode pos = element.GetElementsByTagName("Pos")[0];
XmlNode startPos = element.GetElementsByTagName("StartPos")[0];
this.TextureImage = Manager.contentManager.GetPlatformTexture(int.Parse(dims.ChildNodes[0].InnerText),
int.Parse(dims.ChildNodes[1].InnerText), int.Parse(dims.ChildNodes[2].InnerText));
this.Position = new Vector2(float.Parse(pos.FirstChild.InnerText), float.Parse(pos.LastChild.InnerText));
this.StartPosition = new Vector2(float.Parse(startPos.FirstChild.InnerText), float.Parse(startPos.LastChild.InnerText));
this.FrameDims = new Point(this.TextureImage.Width, this.TextureImage.Height);
}
示例13: CompileRuleset
private static ValidationRuleSet CompileRuleset(XmlElement rulesetNode)
{
var compiler = new XmlSpecificationCompiler(ScriptLanguage);
var rules = CollectionUtils.Map<XmlElement, ISpecification>(
rulesetNode.GetElementsByTagName(TagValidationRule), compiler.Compile);
var applicabilityRuleNode = CollectionUtils.FirstElement(rulesetNode.GetElementsByTagName(TagApplicabililtyRule));
return applicabilityRuleNode != null ?
new ValidationRuleSet(rules, compiler.Compile((XmlElement)applicabilityRuleNode))
: new ValidationRuleSet(rules);
}
示例14: InstanceData
/// <summary>
/// Constructor which takes an XML node as returned by the web service.
/// </summary>
/// <param name="instanceElem"></param>
public InstanceData(XmlElement instanceElem)
{
this.InstanceId = ((XmlElement)instanceElem
.GetElementsByTagName("instanceId")[0])
.InnerText;
this.CourseVersion = ((XmlElement)instanceElem
.GetElementsByTagName("courseVersion")[0])
.InnerText;
this.UpdateDate = DateTime.Parse(((XmlElement)instanceElem
.GetElementsByTagName("updateDate")[0])
.InnerText);
}
示例15: ReadFrom
public void ReadFrom(XmlElement jobAndWorkerTypeElement)
{
//JobType
Debug.Assert(jobAndWorkerTypeElement != null, "jobAndWorkerTypeElement != null");
var jobTypeElement = (XmlElement)jobAndWorkerTypeElement.GetElementsByTagName("JobType")[0];
JobType = new RuntimeType();
JobType.ReadFrom(jobTypeElement);
//WorkerType
var workerTypeElement = (XmlElement)jobAndWorkerTypeElement.GetElementsByTagName("WorkerType")[0];
WorkerType = new RuntimeType();
WorkerType.ReadFrom(workerTypeElement);
}