public String TransformBodyContent(Message message, String formName, Dictionary <String, String> parameters) { String Content = String.Empty; Stream FormResult = TransformMessage(message, formName, parameters); if (FormResult != null) { ValidatingTransform Brand = null; XsltArgumentList BrandArguments = new XsltArgumentList(); if (parameters.ContainsKey("Brand")) { Brand = Transforms[parameters["Brand"]]; } else { if (AllowFallbackBrand) { Brand = FallbackBrand; } else { throw new CascadesException("Brand transform not specified and fallback not allowed"); } } Stream Output = Brand.Apply(FormResult, BrandArguments); XmlReader OutputReader = XmlReader.Create(Output); OutputReader.MoveToContent(); Content = OutputReader.ReadOuterXml(); } return(Content); }
public StatusReader(Configuration configuration) { CascadesInterfaceConfigurationSection Section = configuration.GetSection("CascadesInterface2") as CascadesInterfaceConfigurationSection; RefreshTime = Section.RefreshTime; FileName = Section.FileName; AllowFallbackBrand = Section.AllowFallbackBrand; TransformConfigurationCollection TransformConfigCollection = Section.Transforms; Transforms = new ValidatingTransformCollection(Section.Transforms); if (Transforms.ContainsKey("Brand")) { FallbackBrand = Transforms["Brand"]; } }
private Stream TransformMessage(Message message, String formName, Dictionary <String, String> parameters) { Stream FormResult = null; ValidatingTransform FormTransform = Transforms[formName]; if (FormTransform != null && message != null) { XsltArgumentList Arguments = new XsltArgumentList(); if (parameters != null) { foreach (String Key in parameters.Keys) { String Value = parameters[Key]; Arguments.AddParam(Key, "", Value); } } String DateString = DateTime.Now.ToString("O"); Arguments.AddParam(DateTimeParameterName, "", DateString); XmlReader Reader = message.CreateReader(); FormResult = FormTransform.Apply(Reader, Arguments); Reader.Close(); } return(FormResult); }