public void ElementStart(IFormHandlerContext context) { ElementInfo ei = context.CurrentElement; tid = ei.GetAttributeValue("tid"); if (tid != null) tid = Convert.ToString(context.Eval(tid)); mode = ei.GetAttributeValue("persist-mode"); if (mode == null) mode = "savepoint"; string xsl = ei.GetAttributeValue("stylesheet"); if (xsl != "none") { if (xsl == null) xsl = "szablon.xsl"; context.Output.WriteProcessingInstruction("xml-stylesheet", string.Format("type=\"text/xsl\" href=\"{0}\"", xsl)); } Dictionary<string, object> state; //if (tid != null) //{ //context.ViewState = _pm.GetState(tid); //} //if (context.ViewState == null) //{ //context.ViewState = new Dictionary<string, object>(); //} string elName = ei.Name; context.Output.WriteStartElement("r", elName, "http://www.rg.com"); foreach (AttributeInfo ai in ei.Attributes.Values) { if (ai.Name == "tid") continue; context.Output.WriteAttributeString(ai.Prefix, ai.Name, ai.NamespaceUri, ai.Value); } }
public void ElementStart(IFormHandlerContext context) { ElementInfo ei = context.CurrentElement; string elName = ei.GetAttributeValue("name"); string elNs = ei.GetAttributeValue("namespace"); if (elNs == null) elNs = Helper.TargetNamespace; context.Output.WriteStartElement(elName, elNs); }
public void ElementStart(IFormHandlerContext context) { ElementInfo ei = context.CurrentElement; AttributeInfo tst = ei.GetAttribute("expr"); if (tst == null) throw new Exception("Missing 'expr' attribute in <value>"); string expr = tst.Value; object obj = context.Eval(expr); if (obj != null) context.Output.WriteString(Convert.ToString(obj)); }
public void ElementStart(IFormHandlerContext context) { ElementInfo ei = context.CurrentElement; string typeName = ei.GetAttributeValue("type"); if (typeName == null) throw new Exception("type not specified in <custom>"); Type t = Type.GetType(typeName); if (t == null) throw new Exception("Type not found: " + typeName); _handler = (IElementHandler) Activator.CreateInstance(t); if (_handler == null) throw new Exception("Failed to create instance of type " + typeName); _handler.ElementStart(context); }
public void ElementStart(IFormHandlerContext context) { ElementInfo ei = context.CurrentElement; AttributeInfo tst = ei.GetAttribute("test"); if (tst == null) throw new Exception("Missing 'test' attribute in <if>"); string expr = tst.Value; object obj = context.Eval(expr); if (obj == null || !Convert.ToBoolean(obj)) context.SkipElementContent = true; else context.SkipElementContent = false; }
private void FindObjectView(IFormHandlerContext ctx) { ElementInfo ei = null; for (int i = ctx.ElementStackSize - 1; i > 0; i--) { ElementInfo t = ctx.PeekElementStack(i); if (t.Handler is ObjectViewHandler) { ei = t; break; } } if (ei == null) throw new Exception("Object view not found"); _binder = ((ObjectViewHandler)ei.Handler).DataBinder; }
public void ElementStart(IFormHandlerContext context) { FindObjectView(context); object root = null; // context.T; ElementInfo ei = context.CurrentElement; string fname = ei.GetAttributeValue("name"); FormFieldInfo fi = _binder.GetFieldInfo(fname); XmlWriter o = context.Output; o.WriteStartElement("field", Helper.TargetNamespace); o.WriteAttributeString("mode", fi.Mode.ToString()); o.WriteAttributeString("value", fi.Value); if (fi.DisplayValue != null) o.WriteAttributeString("display", fi.DisplayValue); o.WriteAttributeString("name", fi.Name); o.WriteAttributeString("data_source", fi.DataSource); o.WriteAttributeString("id", context.GetNextId()); o.WriteEndElement(); }
public void ElementEnd(IFormHandlerContext context) { string newTid = null; bool save = true; if (mode == "discard") { save = false; } else if (mode == "savepoint") { //newTid = _pm.AllocateSubTid(tid); } else throw new Exception("Unexpected persist-mode. supported are: discard, savepoint, commit"); if (save) { //_pm.SaveState(context.ViewState, newTid); } context.Output.WriteStartElement("pagecontext", "http://www.rg.com"); context.Output.WriteAttributeString("tid", newTid); context.Output.WriteEndElement(); context.Output.WriteEndElement(); }
public void ElementEnd(IFormHandlerContext context) { context.Output.WriteEndElement(); }
public void ElementEnd(IFormHandlerContext context) { }
public void ElementStart(IFormHandlerContext context) { ElementInfo ei = context.CurrentElement; context.Output.WriteStartElement("tree", Helper.TargetNamespace); }
public void ElementEnd(IFormHandlerContext context) { _handler.ElementEnd(context); }