System.Xml.Xsl.XsltOld.CompiledAction.CheckEmpty C# (CSharp) Method

CheckEmpty() public method

public CheckEmpty ( Compiler compiler ) : void
compiler Compiler
return void
        public void CheckEmpty(Compiler compiler) {
            // Really EMPTY means no content at all, but the sake of compatibility with MSXML we allow whitespaces
            string elementName = compiler.Input.Name;
            if (compiler.Recurse()) {
                do {
                    // Note: <![CDATA[ ]]> will be reported as XPathNodeType.Text
                    XPathNodeType nodeType = compiler.Input.NodeType;
                    if (
                        nodeType != XPathNodeType.Whitespace            &&
                        nodeType != XPathNodeType.Comment               &&
                        nodeType != XPathNodeType.ProcessingInstruction
                    ) {
                        throw XsltException.Create(Res.Xslt_NotEmptyContents, elementName);
                    }
                }
                while (compiler.Advance());
                compiler.ToParent();
            }
        }