本文整理匯總了C#中System.Xml.XmlNode.IsText方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlNode.IsText方法的具體用法?C# XmlNode.IsText怎麽用?C# XmlNode.IsText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.XmlNode
的用法示例。
在下文中一共展示了XmlNode.IsText方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TextEnd
private XmlNode TextEnd(XmlNode node)
{
XmlNode end;
do
{
end = node;
node = NextSibling(node);
}
while (node != null
&& node.IsText());
return end;
}
示例2: PreviousTextTail
private XmlNode PreviousTextTail(XmlNode node, XmlNode text)
{
if (text != null)
{
return text;
}
if (!node.IsText())
{
return null;
}
XmlNode sibling = node.PreviousSibling;
while (sibling == null)
{
node = node.ParentNode;
if (node == null
|| node.NodeType != XmlNodeType.EntityReference)
{
return null;
}
sibling = node.PreviousSibling;
}
while (sibling != null)
{
switch (sibling.NodeType)
{
case XmlNodeType.EntityReference:
sibling = sibling.LastChild;
break;
case XmlNodeType.Text:
case XmlNodeType.CDATA:
case XmlNodeType.Whitespace:
case XmlNodeType.SignificantWhitespace:
return sibling;
default:
return null;
}
}
return null;
}
示例3: TextStart
private XmlNode TextStart(XmlNode node)
{
XmlNode start;
do
{
start = node;
node = PreviousSibling(node);
}
while (node != null
&& node.IsText());
return start;
}
示例4: NormalizeText
private static XmlNode NormalizeText(XmlNode n)
{
XmlNode retnode = null;
while (n.IsText())
{
retnode = n;
n = n.PreviousSibling;
if (n == null)
{
XmlNode intnode = retnode;
while (true)
{
if (intnode.ParentNode != null && intnode.ParentNode.NodeType == XmlNodeType.EntityReference)
{
if (intnode.ParentNode.PreviousSibling != null)
{
n = intnode.ParentNode.PreviousSibling;
break;
}
else
{
intnode = intnode.ParentNode;
if (intnode == null)
break;
}
}
else
break;
}
}
if (n == null)
break;
while (n.NodeType == XmlNodeType.EntityReference)
{
n = n.LastChild;
// The only possibility of this happening is when
// XmlEntityReference is not expanded.
// All entities are expanded when created in XmlDocument.
// If you try to create standalone XmlEntityReference
// it is not expanded until you set its parent.
Debug.Assert(n != null);
}
}
return retnode;
}