private bool IsValidChild(XmlNode parent, XmlNode child)
{
int xntChildInt = s_xmlNodeType_To_XpathNodeType_Map[(int)(child.NodeType)];
if (xntChildInt == -1)
return false;
int xntInt = s_xmlNodeType_To_XpathNodeType_Map[(int)(parent.NodeType)];
Debug.Assert(xntInt != -1);
switch (xntInt)
{
case (int)XPathNodeType.Root:
return (xntChildInt == (int)XPathNodeType.Element ||
xntChildInt == (int)XPathNodeType.Comment ||
xntChildInt == (int)XPathNodeType.ProcessingInstruction);
case (int)XPathNodeType.Element:
return (xntChildInt == (int)XPathNodeType.Element ||
xntChildInt == (int)XPathNodeType.Text ||
xntChildInt == (int)XPathNodeType.Comment ||
xntChildInt == (int)XPathNodeType.Whitespace ||
xntChildInt == (int)XPathNodeType.SignificantWhitespace ||
xntChildInt == (int)XPathNodeType.ProcessingInstruction);
default:
return false;
}
}