考虑到以下十项法律:
<Checks>
<IsSomethingCheck Param="1"/>
<IsSomeoneCheck Param2="2"/>
<Checks Operator="Or">
<IsAnythingCheck Param3="3"/>
</Checks>
</Checks>
我怎样回击<密码>中的孩子?
下面的法典适用于最外生儿童,但停止了处理大多数内身儿童的工作(内部编码
protected override void InitializePlugin(XmlElement xmlElement)
{
Enum.TryParse(xmlElement.GetAttribute("Operator"), out _operator);
XPathNodeIterator nav = xmlElement.CreateNavigator().Select("Checks/*");
foreach (XPathNavigator checkNode in nav)
{
if (_checksLookup.ContainsKey(checkNode.Name))
{
Type checkType = _checksLookup[checkNode.Name];
Check check = Activator.CreateInstance(checkType) as Check;
check.Initialize(checkNode.OuterXml);
Checks.Add(check);
}
}
}
PS:这一方法的XmlElement预计会得到XML中整个<代码>Checks部分。