internal override void Execute(Processor processor, ActionFrame frame) {
Debug.Assert(processor != null && frame != null);
switch (frame.State) {
case Initialized:
if(this.nameAvt == null) {
frame.StoredOutput = this.name;
if(this.name == null) {
// name was static but was bad;
frame.Finished();
break;
}
}
else {
frame.StoredOutput = this.nameAvt.Evaluate(processor, frame);
if (! IsProcessingInstructionName(frame.StoredOutput)) {
frame.Finished();
break;
}
}
goto case NameReady;
case NameReady:
Debug.Assert(frame.StoredOutput != null);
if (processor.BeginEvent(XPathNodeType.ProcessingInstruction, string.Empty, frame.StoredOutput, string.Empty, false) == false) {
// Come back later
frame.State = NameReady;
break;
}
processor.PushActionFrame(frame);
frame.State = ProcessingChildren;
break; // Allow children to run
case ProcessingChildren:
if (processor.EndEvent(XPathNodeType.ProcessingInstruction) == false) {
frame.State = ProcessingChildren;
break;
}
frame.Finished();
break;
default:
Debug.Fail("Invalid ElementAction execution state");
frame.Finished();
break;
}
}