本文整理汇总了C#中Nodes.Node.CascadeOverride方法的典型用法代码示例。如果您正苦于以下问题:C# Node.CascadeOverride方法的具体用法?C# Node.CascadeOverride怎么用?C# Node.CascadeOverride使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nodes.Node
的用法示例。
在下文中一共展示了Node.CascadeOverride方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseMStyle
public StyleAttributes ParseMStyle(XmlNode xmlNode, StyleAttributes baseStyle)
{
bool hasStyleAttrs = false;
bool hasColor = false;
bool hasBackground = false;
bool hasMathsize = false;
bool hasVariant = false;
StyleAttributes r = null;
int count = 0;
if (((xmlNode != null) &&
(((xmlNode.Name == "mi") || (xmlNode.Name == "mo")) ||
(((xmlNode.Name == "mn") || (xmlNode.Name == "ms")) || (xmlNode.Name == "mtext")))) &&
(xmlNode.Attributes != null))
{
try
{
count = xmlNode.Attributes.Count;
for (int i = 0; i < count; i++)
{
string name = xmlNode.Attributes[i].Name.Trim().ToLower();
if (((name == "mathvariant") || (name == "mathcolor")) ||
((name == "mathbackground") || (name == "mathsize")))
{
hasStyleAttrs = true;
}
if (name == "mathvariant")
{
hasVariant = true;
}
if (name == "mathcolor")
{
hasColor = true;
}
if (name == "mathbackground")
{
hasBackground = true;
}
if (name == "mathsize")
{
hasMathsize = true;
}
}
}
catch
{
}
}
if (hasStyleAttrs)
{
try
{
Node n = new Node();
n.attrs = new AttributeList();
for (int i = 0; i < count; i++)
{
n.attrs.Add(new Attribute(xmlNode.Attributes[i].Name, xmlNode.Attributes[i].Value, ""));
}
StyleAttributes nodeStyleAttrs = AttributeBuilder.StyleAttrsFromNode(n);
if (nodeStyleAttrs != null)
{
nodeStyleAttrs.canOverride = true;
r = new StyleAttributes();
if (baseStyle != null)
{
n.style_ = new StyleAttributes();
nodeStyleAttrs.CopyTo(n.style_);
r = n.CascadeOverride(baseStyle);
}
else
{
nodeStyleAttrs.CopyTo(r);
}
r.canOverride = true;
}
if (hasMathsize)
{
xmlNode.Attributes.RemoveNamedItem("mathsize", "");
}
if (hasVariant)
{
xmlNode.Attributes.RemoveNamedItem("mathvariant", "");
}
if (hasColor)
{
xmlNode.Attributes.RemoveNamedItem("mathcolor", "");
}
if (hasBackground)
{
xmlNode.Attributes.RemoveNamedItem("mathbackground", "");
}
}
catch
{
//.........这里部分代码省略.........
示例2: ParseMstyle
public Node ParseMstyle(XmlNode XMLNode, Types mTypes, EntityManager mEntities, bool bAll, StyleAttributes styleAttributes)
{
StyleAttributes s = null;
if ((XMLNode.Attributes == null) || (XMLNode.Attributes.Count <= 0))
{
return Parse(XMLNode, mTypes, mEntities, bAll, styleAttributes, true);
}
Node node = new Node();
node.type_ = mTypes["mstyle"];
node.attrs = new AttributeList();
for (int i = 0; i < XMLNode.Attributes.Count; i++)
{
node.attrs.Add(new Attribute(XMLNode.Attributes[i].Name, XMLNode.Attributes[i].Value, ""));
}
StyleAttributes fromNode = new StyleAttributes();
s = new StyleAttributes();
fromNode = AttributeBuilder.StyleAttrsFromNode(node, true);
if (fromNode != null)
{
if (styleAttributes != null)
{
node.style_ = new StyleAttributes();
fromNode.CopyTo(node.style_);
node.style_.canOverride = true;
s = node.CascadeOverride(styleAttributes);
}
else
{
fromNode.CopyTo(s);
}
}
else
{
if (styleAttributes != null)
styleAttributes.CopyTo(s);
}
s.canOverride = true;
XMLNode.Attributes.RemoveAll();
return Parse(XMLNode, mTypes, mEntities, bAll, s, true);
}