internal static HxlTemplate LoadMaster( IHxlTemplateFactory templateFactory, bool ignoreErrors, string layoutName) { if (templateFactory == HxlTemplateFactory.Null) { if (ignoreErrors) { return(null); } throw HxlFailure.CannotLoadAnyMasterTemplates(); } var master = templateFactory.CreateTemplate(layoutName, "layout", null); if (master == null) { if (ignoreErrors) { return(null); } throw HxlFailure.CannotLoadMasterTemplate(layoutName); } return(master); }
private void VerifyPrefix(string prefix, string argumentName) { if (prefix == null) { throw new ArgumentNullException(argumentName); } if (string.IsNullOrEmpty(prefix)) { throw Failure.EmptyString(argumentName); } if (this.map.ContainsKey(prefix)) { throw HxlFailure.PrefixAlreadyDefined("prefix", prefix); } switch (prefix) { case "hxl": case "c": case "xml": case "xmlns": throw HxlFailure.CannotUseBuiltinPrefixes(argumentName); } }
public override Type GetElementNodeType(HxlQualifiedName name) { if (name == null) { throw new ArgumentNullException("name"); } throw HxlFailure.NoMatchingServerElement(name.FullName); }
public override DomAttribute CreateAttribute(HxlQualifiedName name) { if (name == null) { throw new ArgumentNullException("name"); } throw HxlFailure.NoMatchingServerAttribute(name.FullName); }
protected override Uri LookupNamespace(string prefix) { var result = base.LookupNamespace(prefix); if (result == null) { throw HxlFailure.PrefixDoesNotMapToNamespace(prefix); } return(result); }
public static HxlTemplate FromName(Assembly assembly, string name, string type) { if (assembly == null) { throw new ArgumentNullException("assembly"); } #if NET if (assembly.ReflectionOnly) { throw HxlFailure.AssemblyIsReflectionOnly("assembly"); } #endif var f = HxlTemplateFactory.FromAssembly(assembly); return(f.CreateTemplate(name, null, null)); }
public void Render(DomElement element, HxlWriter output) { var eti = new HxlElementTemplateInfo(element.Name, element.Attribute("class")); var services = ServiceProvider.Compose( ServiceProvider.Current, ServiceProvider.FromValue(eti)); var template = output.TemplateContext.TemplateFactory.CreateTemplate(_name, _type, services); if (template == null) { // TODO Missing line number throw HxlFailure.CannotFindMatchingTemplate(_type, _name, -1, -1); } var context = output.TemplateContext.CreateChildContext(template); context.Data.Add("element", element); template.Transform(output.BaseWriter, context); }
private void InvalidWrite() { throw HxlFailure.InvalidToWriteTextOutput(); }