Пример #1
0
        public bool Apply(XmlDocument xmlTarget)
        {
            Debug.Assert(this.xmlTarget == null, "This method should not be called recursively");

            if (this.xmlTarget == null)
            {
                // Reset the error state
                logger.HasLoggedErrors = false;

                this.xmlTarget        = xmlTarget;
                this.xmlTransformable = xmlTarget as XmlTransformableDocument;
                try {
                    if (hasTransformNamespace)
                    {
                        InitializeDocumentServices(xmlTarget);

                        TransformLoop(xmlTransformation);
                    }
                    else
                    {
                        logger.LogMessage(MessageType.Normal, "The expected namespace {0} was not found in the transform file", TransformNamespace);
                    }
                }
                catch (Exception ex) {
                    HandleException(ex);
                }
                finally {
                    ReleaseDocumentServices();

                    this.xmlTarget        = null;
                    this.xmlTransformable = null;
                }

                return(!logger.HasLoggedErrors);
            }
            else
            {
                return(false);
            }
        }