Esempio n. 1
0
 private Exception WrapException(Exception ex)
 {
     return(XmlNodeException.Wrap(ex, Element));
 }
Esempio n. 2
0
        internal void Execute(XmlElementContext context, string argumentString)
        {
            Debug.Assert(this.context == null && this.argumentString == null, "Don't call Execute recursively");
            Debug.Assert(this.logger == null, "Logger wasn't released from previous execution");

            if (this.context == null && this.argumentString == null)
            {
                bool error          = false;
                bool startedSection = false;

                try {
                    this.context        = context;
                    this.argumentString = argumentString;
                    this.arguments      = null;

                    if (ShouldExecuteTransform())
                    {
                        startedSection = true;

                        Log.StartSection(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformBeginExecutingMessage, TransformNameLong);
                        Log.LogMessage(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformStatusXPath, context.XPath);

                        if (ApplyTransformToAllTargetNodes)
                        {
                            ApplyOnAllTargetNodes();
                        }
                        else
                        {
                            ApplyOnce();
                        }
                    }
                }
                catch (Exception ex) {
                    error = true;
                    if (context.TransformAttribute != null)
                    {
                        Log.LogErrorFromException(XmlNodeException.Wrap(ex, context.TransformAttribute));
                    }
                    else
                    {
                        Log.LogErrorFromException(ex);
                    }
                }
                finally {
                    if (startedSection)
                    {
                        if (error)
                        {
                            Log.EndSection(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformErrorExecutingMessage, TransformNameShort);
                        }
                        else
                        {
                            Log.EndSection(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformEndExecutingMessage, TransformNameShort);
                        }
                    }
                    else
                    {
                        Log.LogMessage(MessageType.Normal, SR.XMLTRANSFORMATION_TransformNotExecutingMessage, TransformNameLong);
                    }

                    this.context        = null;
                    this.argumentString = null;
                    this.arguments      = null;

                    ReleaseLogger();
                }
            }
        }
Esempio n. 3
0
 private Exception WrapException(Exception ex, XmlNode node)
 {
     return(XmlNodeException.Wrap(ex, node));
 }
Esempio n. 4
0
 private Exception WrapException(Exception ex, XmlNodeContext context)
 {
     return(XmlNodeException.Wrap(ex, context.Node));
 }