Beispiel #1
0
 public XElement Axis(XPathAxis xpathAxis, System.Xml.XPath.XPathNodeType nodeType, string prefix, string name)
 {
     return(new XElement(xpathAxis.ToString(),
                         new XAttribute("nodeType", nodeType.ToString()),
                         new XAttribute("prefix", prefix ?? "(null)"),
                         new XAttribute("name", name ?? "(null)")
                         ));
 }
Beispiel #2
0
        public override string ToString()
        {
            string res = "Not implemented for " + NodeType.ToString();

            switch (this.NodeType)
            {
            case System.Xml.XPath.XPathNodeType.All:
                break;

            case System.Xml.XPath.XPathNodeType.Namespace:
                if (string.IsNullOrEmpty(NodeName))
                {
                    res = "xmlns = " + NodeValue;
                }
                else
                {
                    res = string.Format("xmlns:{0} = {1}", NodeName, NodeValue);
                }
                break;

            case System.Xml.XPath.XPathNodeType.Attribute:
                res = string.Format("{0} = {1}", NodeName, NodeValue);
                break;

            case System.Xml.XPath.XPathNodeType.ProcessingInstruction:
            case System.Xml.XPath.XPathNodeType.Comment:
                res = NodeValue;
                break;

            case System.Xml.XPath.XPathNodeType.Element:
                res = string.Format("{0} >> {1}", NodeName, NodeValue);
                break;

            case System.Xml.XPath.XPathNodeType.Root:
                break;

            case System.Xml.XPath.XPathNodeType.SignificantWhitespace:
                break;

            case System.Xml.XPath.XPathNodeType.Text:
                break;

            case System.Xml.XPath.XPathNodeType.Whitespace:
                break;

            default:
                break;
            }
            return(res);
        }