// // - Methods - // /// <summary> /// Accepts a visitor to visit this instance and all child Content Item instances. /// </summary> /// <remarks> /// When an exception is thrown while this instance is visited, the exception will be /// caught and stored in the visitorExceptions field. All the exceptions from visitors /// will also be stored while serializing to xml. /// </remarks> /// <param name="contentItemVisitor">The visitor.</param> public void Accept(IContentItemVisitor contentItemVisitor) { try { contentItemVisitor.Visit(this); } catch (Exception exception) { Exception visitorException = new Exception(contentItemVisitor.GetType().FullName + " instance has thrown an exception while visiting this Content Item.", exception); this.visitorExceptions.Add(visitorException); } foreach (ContentItem childContentItem in ChildContentItems) { childContentItem.Accept(contentItemVisitor); } }