public void Render(System.Xml.XmlWriter writer) { writer.WriteStartElement("", "Customer", "mvp-xml-templates"); writer.WriteAttributeString("", "xmlns", "http://www.w3.org/2000/xmlns/", "mvp-xml-templates"); writer.WriteAttributeString("", "FullName", "", Converter.ToString(Customer.LastName + ", " + Customer.FirstName)); foreach (Order o in this.Customer.Orders) { //; writer.WriteStartElement("", "Order", "mvp-xml-templates"); writer.WriteAttributeString("", "Id", "", Converter.ToString(o.Id)); writer.WriteAttributeString("", "Premium", "", Converter.ToString(CalculateTotal(o) > 5000)); writer.WriteAttributeString("", "Date", "", Converter.ToString(o.DateOrdered)); writer.WriteStartElement("", "GrandTotal", "mvp-xml-templates"); writer.WriteString(Converter.ToString(CalculateTotal(o))); writer.WriteEndElement(); if (o.Items != null) { //; foreach (Item i in o.Items) { //; writer.WriteStartElement("", "Item", "mvp-xml-templates"); writer.WriteAttributeString("", "Id", "", Converter.ToString(i.ProductId)); writer.WriteAttributeString("", "SubTotal", "", Converter.ToString(i.Quantity * i.Price)); writer.WriteStartElement("", "Quantity", "mvp-xml-templates"); writer.WriteString(Converter.ToString(i.Quantity)); writer.WriteEndElement(); writer.WriteStartElement("", "Price", "mvp-xml-templates"); writer.WriteString(Converter.ToString(i.Price)); writer.WriteEndElement(); writer.WriteEndElement(); }//; }//; writer.WriteEndElement(); }//; writer.WriteEndElement(); }
protected override void ExportData(System.Xml.XmlWriter writer, ExportContext context) { object data = GetData(); var stringData = data as string; if (stringData != null) { writer.WriteString(stringData); return; } var listData = data as List<string>; if (listData != null) { string output = String.Join(";", listData.ToArray()); writer.WriteString(output); return; } var enumerableData = data as IEnumerable; if (enumerableData != null) { var sb = new StringBuilder(); foreach (var item in enumerableData) { if (sb.Length != 0) sb.Append(";"); sb.Append(Convert.ToString(item, CultureInfo.InvariantCulture)); } writer.WriteString(sb.ToString()); return; } throw ExportNotImplementedException(data); }
protected override void ExportData(System.Xml.XmlWriter writer, ExportContext context) { var data = GetData(); var node = data as Node; if (node != null) { writer.WriteStartElement("Path"); writer.WriteString(node.Path); if (context != null) context.AddReference(node.Path); writer.WriteEndElement(); return; } var nodes = data as IEnumerable; if (nodes != null) { foreach (Node item in nodes) { writer.WriteStartElement("Path"); writer.WriteString(item.Path); if (context != null) context.AddReference(item.Path); writer.WriteEndElement(); } return; } throw ExportNotImplementedException(GetData()); }
internal void Write(System.Xml.XmlWriter writer, ODataPersistenceEngineAsync engine) { writer.WriteStartElement("url", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"); if (Value.Name[0] == '$') writer.WriteString(Value.Name); else writer.WriteString(engine.GetUri(Value).ToString()); writer.WriteEndElement(); }
public override void DumpTree(System.Xml.XmlWriter xml) { xml.WriteStartElement("Number"); xml.WriteAttributeString("span", Span.ToString()); xml.WriteString(_text); xml.WriteEndElement(); }
public override void DumpTree(System.Xml.XmlWriter xml) { xml.WriteStartElement("DataTypeKeyword"); xml.WriteAttributeString("span", Span.ToString()); xml.WriteString(Text); xml.WriteEndElement(); }
public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { // Represent the ST as an ED and serialize the ED base.Graph(s, o, result); ST instance = o as ST; // Get rid of these attributes if (result.CompatibilityMode != DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture) { // In R1 data types an ST is a restriction of an ED with these attributes fixed s.WriteAttributeString("mediaType", "text/plain"); s.WriteAttributeString("representation", "TXT"); } // Language if (instance.Language != null) s.WriteAttributeString("language", instance.Language); // Content s.WriteString(instance.Value); // Translation if (instance.Translation != null) result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Translation", "ST", s.ToString())); }
public void Render(System.Xml.XmlWriter writer) { writer.WriteStartDocument(true); writer.WriteStartElement("", "Customer", "mvp-xml-templates"); writer.WriteAttributeString("", "xmlns", "http://www.w3.org/2000/xmlns/", "mvp-xml-templates"); writer.WriteAttributeString("", "Name", "", Converter.ToString(customer.LastName + ", " + customer.FirstName)); writer.WriteStartElement("", "Orders", "mvp-xml-templates"); foreach (Order o in customer.Orders) { //; writer.WriteStartElement("", "Order", "mvp-xml-templates"); writer.WriteAttributeString("", "Id", "", Converter.ToString(o.Id)); writer.WriteAttributeString("", "Premium", "", Converter.ToString((o.GrandTotal > 10000))); writer.WriteStartElement("", "Items", "mvp-xml-templates"); writer.WriteAttributeString("", "GrandTotal", "", Converter.ToString(CalculateTotals(o))); foreach (Item i in o.Items) { //; writer.WriteStartElement("", "Item", "mvp-xml-templates"); writer.WriteAttributeString("", "Id", "", Converter.ToString(i.ProductId)); writer.WriteAttributeString("", "SubTotal", "", Converter.ToString(i.Quantity * i.Price)); writer.WriteEndElement(); }//; writer.WriteEndElement(); writer.WriteStartElement("", "Recipe", "http://schemas.microsoft.com/pag/gax-core"); writer.WriteAttributeString("", "xmlns", "http://www.w3.org/2000/xmlns/", "http://schemas.microsoft.com/pag/gax-core"); writer.WriteAttributeString("", "Name", "", "Foo"); writer.WriteStartElement("", "Caption", "http://schemas.microsoft.com/pag/gax-core"); writer.WriteString(Converter.ToString(o.DateOrdered)); writer.WriteEndElement(); writer.WriteStartElement("", "Description", "http://schemas.microsoft.com/pag/gax-core"); writer.WriteString(("\n\t\t\t\t\tExample of escaping the curly braces: \n\t\t\t\t\tstring.Format(\"" + (Converter.ToString({0}) + ("\");\n\t\t\t\t\t" + (Converter.ToString(o.DateOrdered) + "\n\t\t\t\t"))))); writer.WriteEndElement(); writer.WriteEndElement(); if (customer == null) { //; writer.WriteString("\n\t\t\tNull!\n\t\t\t"); } else if (customer != null) { //; writer.WriteString("\n\t\t\tNot Null!\n\t\t\t"); } else { //; writer.WriteString("\n\t\t\tNever Reached!\n\t\t\t"); }//; writer.WriteEndElement(); }//; writer.WriteEndElement(); writer.WriteEndElement(); }
public override void BuildXml(System.Xml.XmlWriter writer) { writer.WriteStartElement("boolean"); writer.WriteString(BoolValue ? "1" : "0"); writer.WriteEndElement(); }
public override void BuildXml(System.Xml.XmlWriter writer) { writer.WriteStartElement("datetime.iso8601"); writer.WriteString(DateTimeValue.ToString("yyyy-MM-ddThh:mm:ss")); writer.WriteEndElement(); }
public override void BuildXml(System.Xml.XmlWriter writer) { writer.WriteStartElement("double"); writer.WriteString(DoubleValue.ToString()); writer.WriteEndElement(); }
public override void BuildXml(System.Xml.XmlWriter writer) { writer.WriteStartElement("base64"); writer.WriteString(Convert.ToBase64String(((MemoryStream)Value).ToArray())); writer.WriteEndElement(); }
public void Serialize(System.Xml.XmlTextWriter xtw) { xtw.WriteStartElement(m_Property.Name.ToLower()); foreach (Parameter param in m_Property.Parameters) xtw.WriteAttributeString(param.Name.ToLower(), string.Join(",", param.Values.ToArray())); xtw.WriteString(SerializeToString()); xtw.WriteEndElement(); }
/// <summary> /// Graphs the object <paramref name="o"/> onto the stream. /// </summary> /// <param name="s">The XmlWriter stream to write to.</param> /// <param name="o">The object to graph.</param> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { TN tn = (TN)o; base.Graph(s, o, result); if (tn.Part.Count > 0 && tn.NullFlavor == null) s.WriteString(tn.Part[0].Value); if (tn.Part.Count > 1) result.AddResultDetail(new InsufficientRepetitionsResultDetail(ResultDetailType.Warning, "TN is only permitted to have one part", s.ToString())); }
public override void Save(System.Xml.XmlWriter writer) { foreach (var pair in accountGroups) { writer.WriteStartElement("AccountGroup"); writer.WriteAttributeString("name", pair.Key); foreach (var command in pair.Value) { writer.WriteElementString("Command", command.Name); } writer.WriteEndElement(); } foreach (var pair in accounts) { writer.WriteStartElement("Account"); writer.WriteAttributeString("group", pair.Value); writer.WriteString(pair.Key); writer.WriteEndElement(); } }
void System.Xml.Serialization.IXmlSerializable.WriteXml( System.Xml.XmlWriter writer ) { writer.WriteString( this.SerializeColor() ); }
protected override void ExportData(System.Xml.XmlWriter writer, ExportContext context) { writer.WriteString(GetXmlData()); }
/// <summary> /// Writes the XML representation of the answer. /// </summary> /// <param name="writer">The XmlWriter to which to write the answer value.</param> public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteStartElement("TFValue"); if (_protect) writer.WriteAttributeString("userModifiable", System.Xml.XmlConvert.ToString(!_protect)); if (IsAnswered) writer.WriteString(System.Xml.XmlConvert.ToString(_value.Value)); else writer.WriteAttributeString("unans", System.Xml.XmlConvert.ToString(true)); writer.WriteEndElement(); }
/* -*- Mode: csharp; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ //namespace { public void ToXml (System.Xml.XmlTextWriter writer) { writer.WriteStartElement ("match"); if (this.ChannelId != null) writer.WriteElementString ("channel", this.ChannelId); if (this.Dep != null) this.Dep.ToXml (writer); if (this.Glob != null) writer.WriteElementString ("glob", this.Glob); bool gteq; PackageImportance imp = this.GetImportance (out gteq); if (imp != PackageImportance.Invalid) { writer.WriteStartElement ("importance"); writer.WriteAttributeString ("gteq", gteq ? "1" : "0"); writer.WriteString (Global.ImportanceToString (imp)); writer.WriteEndElement (); } writer.WriteEndElement (); }
internal void WriteXml(System.Xml.XmlWriter writer) { Check.Require(this.OriginalLanguage!=null, "AuthoredResource.OriginalLanguage must not be null."); string openEhrPrefix = RmXmlSerializer.UseOpenEhrPrefix(writer); string xsiPrefix = RmXmlSerializer.UseXsiPrefix(writer); writer.WriteStartElement(openEhrPrefix, "original_language", RmXmlSerializer.OpenEhrNamespace); this.OriginalLanguage.WriteXml(writer); writer.WriteEndElement(); if (this.isControlledSet) { writer.WriteStartElement(openEhrPrefix, "is_controlled", RmXmlSerializer.OpenEhrNamespace); writer.WriteString(this.IsControlled.ToString()); writer.WriteEndElement(); } if (this.Description != null) { writer.WriteStartElement(openEhrPrefix, "description", RmXmlSerializer.OpenEhrNamespace); this.Description.WriteXml(writer); writer.WriteEndElement(); } if (this.Translations != null) { foreach (string language in this.Translations.Keys) { writer.WriteStartElement(openEhrPrefix, "translations", RmXmlSerializer.OpenEhrNamespace); this.Translations.Item(language).WriteXml(writer); writer.WriteEndElement(); } } if (this.RevisionHistory != null) { writer.WriteStartElement(openEhrPrefix, "revision_history", RmXmlSerializer.OpenEhrNamespace); this.RevisionHistory.WriteXml(writer); writer.WriteEndElement(); } }
/// <summary> /// Serializes the FilePattern to Xml.<br/> /// WriteXml is part of the IXmlSerializable interface. /// </summary> public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteString(Pattern); }
/// <summary> Write a SqlUpdate XML Element from attributes in a member. </summary> public virtual void WriteSqlUpdate(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, SqlUpdateAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass) { writer.WriteStartElement( "sql-update" ); // Attribute: <callable> if( attribute.CallableSpecified ) writer.WriteAttributeString("callable", attribute.Callable ? "true" : "false"); // Attribute: <check> if(attribute.Check != CustomSqlCheck.Unspecified) writer.WriteAttributeString("check", GetXmlEnumValue(typeof(CustomSqlCheck), attribute.Check)); WriteUserDefinedContent(writer, member, null, attribute); // Write the content of this element (mixed="true") writer.WriteString(attribute.Content); writer.WriteEndElement(); }
/// <summary> Write a Param XML Element from attributes in a member. </summary> public virtual void WriteParam(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, ParamAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass) { writer.WriteStartElement( "param" ); // Attribute: <name> writer.WriteAttributeString("name", attribute.Name==null ? DefaultHelper.Get_Param_Name_DefaultValue(member) : GetAttributeValue(attribute.Name, mappedClass)); WriteUserDefinedContent(writer, member, null, attribute); // Write the content of this element (mixed="true") writer.WriteString(attribute.Content); writer.WriteEndElement(); }
/// <summary> Write a Formula XML Element from attributes in a member. </summary> public virtual void WriteFormula(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, FormulaAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass) { writer.WriteStartElement( "formula" ); WriteUserDefinedContent(writer, member, null, attribute); // Write the content of this element (mixed="true") writer.WriteString(attribute.Content); writer.WriteEndElement(); }
/// <summary> Write a Meta XML Element from attributes in a member. </summary> public virtual void WriteMeta(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, MetaAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass) { writer.WriteStartElement( "meta" ); // Attribute: <attribute> writer.WriteAttributeString("attribute", attribute.Attribute==null ? DefaultHelper.Get_Meta_Attribute_DefaultValue(member) : GetAttributeValue(attribute.Attribute, mappedClass)); // Attribute: <inherit> if( attribute.InheritSpecified ) writer.WriteAttributeString("inherit", attribute.Inherit ? "true" : "false"); WriteUserDefinedContent(writer, member, null, attribute); // Write the content of this element (mixed="true") writer.WriteString(attribute.Content); writer.WriteEndElement(); }
public void WriteXml(System.Xml.XmlWriter writer) { ColorConverter cconv = new ColorConverter(); writer.WriteString(cconv.ConvertToString(_color)); }
/// <summary> Write a SqlQuery XML Element from attributes in a member. </summary> public virtual void WriteSqlQuery(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, SqlQueryAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass) { writer.WriteStartElement( "sql-query" ); // Attribute: <name> writer.WriteAttributeString("name", attribute.Name==null ? DefaultHelper.Get_SqlQuery_Name_DefaultValue(member) : GetAttributeValue(attribute.Name, mappedClass)); // Attribute: <resultset-ref> if(attribute.ResultSetRef != null) writer.WriteAttributeString("resultset-ref", GetAttributeValue(attribute.ResultSetRef, mappedClass)); // Attribute: <flush-mode> if(attribute.FlushMode != FlushMode.Unspecified) writer.WriteAttributeString("flush-mode", GetXmlEnumValue(typeof(FlushMode), attribute.FlushMode)); // Attribute: <cacheable> if( attribute.CacheableSpecified ) writer.WriteAttributeString("cacheable", attribute.Cacheable ? "true" : "false"); // Attribute: <cache-region> if(attribute.CacheRegion != null) writer.WriteAttributeString("cache-region", GetAttributeValue(attribute.CacheRegion, mappedClass)); // Attribute: <fetch-size> if(attribute.FetchSize != -9223372036854775808) writer.WriteAttributeString("fetch-size", attribute.FetchSize.ToString()); // Attribute: <timeout> if(attribute.Timeout != -1) writer.WriteAttributeString("timeout", attribute.Timeout.ToString()); // Attribute: <cache-mode> if(attribute.CacheMode != CacheMode.Unspecified) writer.WriteAttributeString("cache-mode", GetXmlEnumValue(typeof(CacheMode), attribute.CacheMode)); // Attribute: <read-only> if( attribute.ReadOnlySpecified ) writer.WriteAttributeString("read-only", attribute.ReadOnly ? "true" : "false"); // Attribute: <comment> if(attribute.Comment != null) writer.WriteAttributeString("comment", GetAttributeValue(attribute.Comment, mappedClass)); // Attribute: <callable> if( attribute.CallableSpecified ) writer.WriteAttributeString("callable", attribute.Callable ? "true" : "false"); WriteUserDefinedContent(writer, member, null, attribute); // Write the content of this element (mixed="true") writer.WriteString(attribute.Content); writer.WriteEndElement(); }
public override void WriteXml(System.Xml.XmlWriter writer) { XmlRootAttribute root = (XmlRootAttribute)this.GetType().GetCustomAttributes(typeof(XmlRootAttribute), true).First<object>(); PropertyInfo[] properties = this.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public); foreach (PropertyInfo property in properties) { if (property.GetCustomAttributes(typeof(XmlAttributeAttribute), true).Length == 1) { var propValue = property.GetValue(this, null); if (propValue != null) { XmlAttributeAttribute attribute = (XmlAttributeAttribute)property.GetCustomAttributes(typeof(XmlAttributeAttribute), true).First<object>(); writer.WriteAttributeString(attribute.AttributeName, propValue.ToString()); } } } writer.WriteString(documentation); }
protected override void ExportData(System.Xml.XmlWriter writer, ExportContext context) { writer.WriteString((bool)GetData() ? "true" : "false"); }
/// <summary> Write a FilterDef XML Element from attributes in a member. </summary> public virtual void WriteFilterDef(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, FilterDefAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass) { writer.WriteStartElement( "filter-def" ); // Attribute: <name> writer.WriteAttributeString("name", attribute.Name==null ? DefaultHelper.Get_FilterDef_Name_DefaultValue(member) : GetAttributeValue(attribute.Name, mappedClass)); // Attribute: <condition> if(attribute.Condition != null) writer.WriteAttributeString("condition", GetAttributeValue(attribute.Condition, mappedClass)); // Attribute: <use-many-to-one> if( attribute.UseManyToOneSpecified ) writer.WriteAttributeString("use-many-to-one", attribute.UseManyToOne ? "true" : "false"); WriteUserDefinedContent(writer, member, null, attribute); // Write the content of this element (mixed="true") writer.WriteString(attribute.Content); writer.WriteEndElement(); }