System.Xml.Xsl.XsltOld.RecordBuilder.BeginEvent C# (CSharp) Method

BeginEvent() private method

private BeginEvent ( int state, XPathNodeType nodeType, string prefix, string name, string nspace, bool empty, Object htmlProps, bool search ) : Processor.OutputResult
state int
nodeType XPathNodeType
prefix string
name string
nspace string
empty bool
htmlProps Object
search bool
return Processor.OutputResult
        internal Processor.OutputResult BeginEvent(int state, XPathNodeType nodeType, string prefix, string name, string nspace, bool empty, Object htmlProps, bool search) {
            if (! CanOutput(state)) {
                return Processor.OutputResult.Overflow;
            }

            Debug.Assert(this.recordState == NoRecord || (state & StateMachine.BeginRecord) == 0);

            AdjustDepth(state);
            ResetRecord(state);
            PopElementScope();

            prefix = (prefix != null) ? this.nameTable.Add(prefix) : this.atoms.Empty;
            name   = (name   != null) ? this.nameTable.Add(name)   : this.atoms.Empty;
            nspace = (nspace != null) ? this.nameTable.Add(nspace) : this.atoms.Empty;

            switch (nodeType) {
            case XPathNodeType.Element:
                this.mainNode.htmlProps = htmlProps as HtmlElementProps;
                this.mainNode.search = search;
                BeginElement(prefix, name, nspace, empty);
                break;
            case XPathNodeType.Attribute:
                BeginAttribute(prefix, name, nspace, htmlProps, search);
                break;
            case XPathNodeType.Namespace:
                BeginNamespace(name, nspace);
                break;
            case XPathNodeType.Text:
                break;
            case XPathNodeType.ProcessingInstruction:
                if (BeginProcessingInstruction(prefix, name, nspace) == false) {
                    return Processor.OutputResult.Error;
                }
                break;
            case XPathNodeType.Comment:
                BeginComment();
                break;
            case XPathNodeType.Root:
                break;
            case XPathNodeType.Whitespace:
            case XPathNodeType.SignificantWhitespace:
            case XPathNodeType.All:
                break;
            }

            return CheckRecordBegin(state);
        }

Usage Example

Ejemplo n.º 1
0
        internal bool BeginEvent(XPathNodeType nodeType, string prefix, string name, string nspace, bool empty, object htmlProps, bool search)
        {
            Debug.Assert(_xsm != null);

            int stateOutlook = _xsm.BeginOutlook(nodeType);

            if (_ignoreLevel > 0 || stateOutlook == StateMachine.Error)
            {
                _ignoreLevel++;
                return(true);                        // We consumed the event, so pretend it was output.
            }

            switch (_builder.BeginEvent(stateOutlook, nodeType, prefix, name, nspace, empty, htmlProps, search))
            {
            case OutputResult.Continue:
                _xsm.Begin(nodeType);
                Debug.Assert(StateMachine.StateOnly(stateOutlook) == _xsm.State);
                Debug.Assert(ExecutionResult == ExecResult.Continue);
                return(true);

            case OutputResult.Interrupt:
                _xsm.Begin(nodeType);
                Debug.Assert(StateMachine.StateOnly(stateOutlook) == _xsm.State);
                ExecutionResult = ExecResult.Interrupt;
                return(true);

            case OutputResult.Overflow:
                ExecutionResult = ExecResult.Interrupt;
                return(false);

            case OutputResult.Error:
                _ignoreLevel++;
                return(true);

            case OutputResult.Ignore:
                return(true);

            default:
                Debug.Fail("Unexpected result of RecordBuilder.BeginEvent()");
                return(true);
            }
        }