/// <summary> /// /// </summary> /// <param name="log"></param> /// <param name="testId"></param> /// <param name="transformer"></param> /// <param name="sourcePath"></param> /// <param name="targetPath"></param> /// <param name="errorCounter"></param> public static void TransformXml(ITestLog log, string testId, IXmlTransformer transformer, string sourcePath, string targetPath, Counter errorCounter) { log.LogInfo($" TransformXml: sourcePath={sourcePath}", testId); log.LogInfo($" TransformXml: targetPath={targetPath}", testId); try { transformer.Transform(sourcePath, targetPath); } catch (Exception excp) { errorCounter.Inc(); log.LogException(excp, testId, false); } }
private void GetChildElements <T>(XmlNode root, XmlDocument xmlDocument, IReader <T> reader, IXmlTransformer transformer) { int i = 0; foreach (var data in reader.GetData()) { i++; XmlNode currentNode; try { currentNode = transformer.Transform(data as string, xmlDocument); } catch (Exception) { this.Logger?.Warn($"Url address on the {i} line is not valid."); continue; } root.AppendChild(currentNode); } }