/// <summary> /// Outputs content into XmlWriter /// </summary> /// <param name="xWriter">XmlWriter to render</param> protected override void RenderContent(System.Xml.XmlWriter xWriter) { xWriter.WriteStartElement("event"); //id if (!string.IsNullOrEmpty(this.ID)) xWriter.WriteAttributeString("id", this.ID); //custom attribs foreach (KeyValuePair<string, string> entry in this.CustomAttribs) xWriter.WriteAttributeString(entry.Key, entry.Value); //start date xWriter.WriteStartElement("start_date"); if (this.StartDate.HasValue) xWriter.WriteCData(this.StartDate.Value.ToString(Tools.DateFormat)); xWriter.WriteEndElement(); //end_date xWriter.WriteStartElement("end_date"); if (this.FinishDate.HasValue) xWriter.WriteCData(this.FinishDate.Value.ToString(Tools.DateFormat)); xWriter.WriteEndElement(); //details fields foreach (string fieldName in this.DataFields.Keys) { xWriter.WriteStartElement(fieldName); xWriter.WriteCData(this.DataFields[fieldName]); xWriter.WriteEndElement(); } xWriter.WriteEndElement(); }
public void SaveTo(System.Xml.XmlWriter x) { x.WriteStartElement("CompilerArg"); x.WriteCData(CompilerArguments); x.WriteEndElement(); x.WriteStartElement("LinkerArgs"); x.WriteCData(LinkerArguments); x.WriteEndElement(); }
/// <summary> /// Ouputs content to response /// </summary> /// <param name="xWriter">XmlWriter object to render content to</param> protected override void RenderContent(System.Xml.XmlWriter xWriter) { xWriter.WriteStartElement("row"); if (!string.IsNullOrEmpty(this.ID)) xWriter.WriteAttributeString("id", this.ID); if (this.HasChildren) xWriter.WriteAttributeString("xmlkids", "1"); //write custom attribs foreach (KeyValuePair<string, string> pair in this.CustomAttribs) xWriter.WriteAttributeString(pair.Key, pair.Value); int cellIndex = 0; foreach (KeyValuePair<string, string> pair in this.DataFields) if (!this.ExtraColumnNames.Contains(pair.Key)) { xWriter.WriteStartElement("cell"); if (cellIndex == 0 && !string.IsNullOrEmpty(this.Image)) xWriter.WriteAttributeString("image", this.Image); xWriter.WriteCData(pair.Value); xWriter.WriteEndElement(); cellIndex++; } foreach (dhtmlxTreeGridDataItem childItem in this.ChildRows) childItem.Render(xWriter); xWriter.WriteEndElement(); }
/// <summary> /// Renders item into response stream provided /// </summary> /// <param name="xWriter">XmlWriter to use for output</param> protected override void RenderContent(System.Xml.XmlWriter xWriter) { xWriter.WriteStartElement("option"); if (!string.IsNullOrEmpty(this.Value)) xWriter.WriteAttributeString("value", this.Value); if (this.Selected) xWriter.WriteAttributeString("selected", "true"); xWriter.WriteCData(this.Text); xWriter.WriteEndElement(); }
public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("lang", this.Lang); writer.WriteAttributeString("category", this.Category.ToString()); writer.WriteAttributeString("title", this.Title); writer.WriteAttributeString("href", this.Href); writer.WriteCData(this.Content); }
/// <summary> /// Serialize the source object into an XmlWriter following "Shallow Copy" business logic. /// </summary> /// <param name="source">The object to serialize.</param> /// <param name="writer">The destination for the xml.</param> /// <param name="propertyName">If serializing a class property provide the name of the property. If serializing a class then set to null.</param> /// <remarks> /// Shallow Copy means that only the exposed properties are serialized. /// Hidden fields, properties, or protected properties are ignored. /// </remarks> public void WriteXml(object source, System.Xml.XmlWriter writer, string propertyName) { string _ElementName; if (source == null) { return; } else if (propertyName == null) { _ElementName = source.GetType().Name; } else { //Use the pre-defined name for the Xml Node Name _ElementName = propertyName; } if (_ElementName.IndexOf("[") > 0) _ElementName = _ElementName.Substring(0, _ElementName.IndexOf("[")); writer.WriteStartElement(_ElementName); //Feature: Added Support for System.Array if (source is System.Array) { writer.WriteAttributeString("size", null, GetArraySize((System.Array)source)); writer.WriteAttributeString("className", null, "System.Array"); writer.WriteAttributeString("type", null, GetArrayType((System.Array)source)); } WriteKey(ref source, writer); WriteClassName(source, writer); if (IsDataType(source)) { if (CDataStorage & (source is System.Char | source is System.String)) { writer.WriteCData(source.ToString().Trim()); } else { writer.WriteString(source.ToString().Trim()); } } else if (source is System.Array) { //Feature: Added Support for System.Array WriteArray((System.Array)source, writer); } else if (source is System.Enum) { writer.WriteString(source.ToString().Trim()); } else { WriteFields(source, writer); WriteProperties(source, writer); // //FIX: July 13, 2006 - Support the scenario where the Item of an IEnumerable is itself an IEnumerable. // if (source is System.Collections.IEnumerable) // { // writer.WriteStartElement("System.Collections.IEnumerable"); // foreach (object _Item in (System.Collections.IEnumerable)source) // { // WriteXml(_Item, writer); // } // writer.WriteEndElement(); // } } writer.WriteEndElement(); }
public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteCData(this.Content); }
public void SaveTo(System.Xml.XmlWriter x) { x.WriteStartElement ("BinaryPath"); x.WriteCData (BinPath); x.WriteEndElement (); foreach (var kv in LinkTargetConfigurations) { x.WriteStartElement ("TargetConfiguration"); kv.Value.SaveTo (x); x.WriteEndElement (); } x.WriteStartElement ("DefaultLibs"); foreach (var lib in DefaultLibraries) { x.WriteStartElement ("lib"); x.WriteCData (lib); x.WriteEndElement (); } x.WriteEndElement (); x.WriteStartElement ("Includes"); foreach (var inc in ParseCache.ParsedDirectories) { x.WriteStartElement ("Path"); x.WriteCData (inc); x.WriteEndElement (); } x.WriteEndElement (); }
private void WriteString(object dataValue, System.Xml.XmlWriter writer) { if (CDataStorage & (dataValue is System.Char | dataValue is System.String | dataValue is System.Enum)) { writer.WriteCData(dataValue.ToString().Trim()); } else { writer.WriteString(dataValue.ToString().Trim()); } }
public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteStartElement( "RequestTemplates" ); foreach ( string request in request_templates ) { writer.WriteStartElement( "Request" ); writer.WriteCData( request ); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteElementString( "URL", URL ); writer.WriteElementString( "SearchDateBeginInterval", SearchDateBeginInterval.ToString() ); writer.WriteElementString( "SearchDateEndInterval", SearchDateEndInterval.ToString() ); writer.WriteElementString( "ShowResponse", ShowResponse.ToString() ); }
protected override void WriteXmlData(System.Xml.XmlWriter writer) { writer.WriteCData((string)GetData()); }
/// <summary> /// Interface implementation, which writes the CDATA tag to the xml /// </summary> void IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { writer.WriteCData(this.text); }
public void SaveTo(System.Xml.XmlWriter x) { foreach (var t in LinkTargetConfigurations) { x.WriteStartElement("TargetConfiguration"); t.SaveTo(x); x.WriteEndElement(); } x.WriteStartElement("DefaultLibs"); foreach (var lib in DefaultLibraries) { x.WriteStartElement("lib"); x.WriteCData(lib); x.WriteEndElement(); } x.WriteEndElement(); x.WriteStartElement("Includes"); foreach (var inc in GlobalParseCache.DirectoryPaths) { x.WriteStartElement("Path"); x.WriteCData(inc); x.WriteEndElement(); } x.WriteEndElement(); }
internal void SaveToXml(System.Xml.XmlTextWriter xmlWriter, string elementName) { xmlWriter.WriteStartElement(elementName); xmlWriter.WriteAttributeString("Name", name); xmlWriter.WriteAttributeString("DataSetType", this.Type.ToString()); if (this.Type == ImageSetType.Sky) { xmlWriter.WriteAttributeString("RA", camParams.RA.ToString()); xmlWriter.WriteAttributeString("Dec", camParams.Dec.ToString()); } else { xmlWriter.WriteAttributeString("Lat", Lat.ToString()); xmlWriter.WriteAttributeString("Lng", Lng.ToString()); } xmlWriter.WriteAttributeString("Constellation", constellation); xmlWriter.WriteAttributeString("Classification", Classification.ToString()); xmlWriter.WriteAttributeString("Magnitude", magnitude.ToString()); xmlWriter.WriteAttributeString("Distance", distnace.ToString()); xmlWriter.WriteAttributeString("AngularSize", AngularSize.ToString()); xmlWriter.WriteAttributeString("ZoomLevel", ZoomLevel.ToString()); xmlWriter.WriteAttributeString("Rotation", camParams.Rotation.ToString()); xmlWriter.WriteAttributeString("Angle", camParams.Angle.ToString()); xmlWriter.WriteAttributeString("Opacity", camParams.Opacity.ToString()); xmlWriter.WriteAttributeString("Target", Target.ToString()); xmlWriter.WriteAttributeString("ViewTarget", camParams.ViewTarget.ToString()); xmlWriter.WriteAttributeString("TargetReferenceFrame", camParams.TargetReferenceFrame); xmlWriter.WriteAttributeString("DomeAlt", camParams.DomeAlt.ToString()); xmlWriter.WriteAttributeString("DomeAz", camParams.DomeAz.ToString()); xmlWriter.WriteStartElement("Description"); xmlWriter.WriteCData(HtmlDescription); xmlWriter.WriteEndElement(); if (backgroundImageSet != null) { xmlWriter.WriteStartElement("BackgroundImageSet"); ImageSetHelper.SaveToXml(xmlWriter, backgroundImageSet, ""); xmlWriter.WriteEndElement(); } if (studyImageset != null) { ImageSetHelper.SaveToXml(xmlWriter, studyImageset, ""); } xmlWriter.WriteEndElement(); }
/// <summary> /// 写入XML /// </summary> /// <param name="s"></param> /// <param name="writer"></param> void WriteXml(string s, System.Xml.XmlWriter writer) { if (string.IsNullOrEmpty(s) == false) { int index = s.IndexOf("]]>"); if (index >= 0) { WriteXml(s.Substring(0, index + 2), writer); WriteXml(s.Substring(index + 2), writer); } else writer.WriteCData(s); } }
protected override void WriteContentsTo(System.Xml.XmlWriter writer) { writer.WriteCData(Text); }
protected override bool SerializeElement(System.Xml.XmlWriter writer, bool serializeCollectionKey) { if( writer != null ) writer.WriteCData(CommandText); return true; }
/// <summary> /// Outputs item into response writer /// </summary> /// <param name="xWriter">XmlWriter to put response to</param> protected override void RenderContent(System.Xml.XmlWriter xWriter) { xWriter.WriteStartElement("row"); //id if (!string.IsNullOrEmpty(this.ID)) xWriter.WriteAttributeString("id", this.ID); //custom attribs foreach(KeyValuePair<string,string> entry in this.CustomAttribs) xWriter.WriteAttributeString(entry.Key, entry.Value); //column cells foreach (string colName in this.DataFields.Keys) if (!this.ExtraColumnNames.Contains(colName)) { xWriter.WriteStartElement("cell"); xWriter.WriteCData(this.DataFields[colName]); xWriter.WriteEndElement(); } xWriter.WriteEndElement(); }
/// <summary> /// Exports the specified XML writer. /// </summary> /// <param name="xmlWriter">The XML writer.</param> /// <param name="includeWindowsUsersAndGroups">if set to <c>true</c> [include windows users and groups].</param> /// <param name="includeDBUsers">if set to <c>true</c> [include DB users].</param> /// <param name="includeAuthorizations">if set to <c>true</c> [include authorizations].</param> /// <param name="ownerOfExport">The owner of export.</param> public void Export(System.Xml.XmlWriter xmlWriter, bool includeWindowsUsersAndGroups, bool includeDBUsers, bool includeAuthorizations, object ownerOfExport) { System.Windows.Forms.Application.DoEvents(); xmlWriter.WriteStartElement("Item"); xmlWriter.WriteAttributeString("Name", this.name); xmlWriter.WriteAttributeString("Description", this.description); xmlWriter.WriteAttributeString("ItemType", this.itemType.ToString()); //Attributes xmlWriter.WriteStartElement("Attributes"); foreach (IAzManAttribute<IAzManItem> attribute in this.GetAttributes()) { ((IAzManExport)attribute).Export(xmlWriter, includeWindowsUsersAndGroups, includeDBUsers, includeAuthorizations, ownerOfExport); } xmlWriter.WriteEndElement(); //Biz Rule if (!String.IsNullOrEmpty(this.bizRuleSource)) { xmlWriter.WriteStartElement("BizRule"); xmlWriter.WriteAttributeString("BizRuleSourceLanguage", this.BizRuleSourceLanguage.Value.ToString()); xmlWriter.WriteCData(this.bizRuleSource); xmlWriter.WriteEndElement(); } //Children xmlWriter.WriteStartElement("Members"); foreach (IAzManItem member in this.GetMembers()) { xmlWriter.WriteStartElement("Member"); xmlWriter.WriteAttributeString("Name", member.Name); xmlWriter.WriteAttributeString("MemberType", member.ItemType.ToString()); xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); //Authorizations if (includeAuthorizations) { xmlWriter.WriteStartElement("Authorizations"); foreach (IAzManAuthorization authorization in this.GetAuthorizations()) { System.Windows.Forms.Application.DoEvents(); ((IAzManExport)authorization).Export(xmlWriter, includeWindowsUsersAndGroups, includeDBUsers, includeAuthorizations, ownerOfExport); } xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); }
protected override bool SerializeElement(System.Xml.XmlWriter writer, bool serializeCollectionKey) { if (writer != null) { writer.WriteCData(Value); } return true; }
public void SaveTo(System.Xml.XmlWriter x) { x.WriteAttributeString("Target",TargetType.ToString()); x.WriteStartElement("CompilerCommand"); x.WriteCData(Compiler); x.WriteEndElement(); x.WriteStartElement("LinkerCommand"); x.WriteCData(Linker); x.WriteEndElement(); x.WriteStartElement("ObjectLinkPattern"); x.WriteCData(ObjectFileLinkPattern); x.WriteEndElement(); x.WriteStartElement("IncludePathPattern"); x.WriteCData(IncludePathPattern); x.WriteEndElement(); x.WriteStartElement("DebugArgs"); DebugArguments.SaveTo(x); x.WriteEndElement(); x.WriteStartElement("ReleaseArgs"); ReleaseArguments.SaveTo(x); x.WriteEndElement(); }
public void SaveTo(System.Xml.XmlWriter x) { x.WriteStartElement ("BinaryPath"); x.WriteCData (BinPath); x.WriteEndElement (); x.WriteStartElement ("VersionId"); x.WriteCData (PredefinedVersionConstant); x.WriteEndElement (); x.WriteStartElement ("CompilerCommand"); x.WriteCData (SourceCompilerCommand); x.WriteEndElement (); x.WriteStartElement ("Patterns"); ArgumentPatterns.SaveTo(x); x.WriteEndElement (); x.WriteStartElement("gdcLibPrefixing"); x.WriteString(EnableGDCLibPrefixing ? "true" : "false"); x.WriteEndElement(); foreach (var kv in LinkTargetConfigurations) { x.WriteStartElement ("TargetConfiguration"); kv.Value.SaveTo (x); x.WriteEndElement (); } x.WriteStartElement ("DefaultLibs"); foreach (var lib in DefaultLibraries) { x.WriteStartElement ("lib"); x.WriteCData (lib); x.WriteEndElement (); } x.WriteEndElement (); x.WriteStartElement ("Includes"); foreach (var inc in ParseCache.ParsedDirectories) { x.WriteStartElement ("Path"); x.WriteCData (inc); x.WriteEndElement (); } x.WriteEndElement (); }
protected override void ExportData(System.Xml.XmlWriter writer, ExportContext context) { writer.WriteCData((string)GetData()); }
public void SaveTo(System.Xml.XmlWriter x) { x.WriteAttributeString ("Target", TargetType.ToString ()); x.WriteStartElement ("LinkerCommand"); x.WriteCData (Linker); x.WriteEndElement (); x.WriteStartElement ("DebugArgs"); DebugArguments.SaveTo (x); x.WriteEndElement (); x.WriteStartElement ("ReleaseArgs"); ReleaseArguments.SaveTo (x); x.WriteEndElement (); }
private void WriteCData(System.Xml.XmlTextWriter writer, string tag, string value) { writer.WriteStartElement(tag); writer.WriteCData(value); writer.WriteEndElement(); }
/// <summary> /// Writes the error data that belongs in child nodes. /// </summary> /// <param name="w">The w.</param> protected void WriteInnerXml(System.Xml.XmlWriter w) { if (w == null) throw new ArgumentNullException("w"); // message + detail if (!string.IsNullOrEmpty(Message) || !string.IsNullOrEmpty(Detail)) { w.WriteStartElement("message"); w.WriteAttributeStringIf("text", Message); if (!string.IsNullOrEmpty(Detail)) w.WriteCData(Detail); w.WriteEndElement(); } // htmlErrorMessage if (!string.IsNullOrEmpty(HtmlErrorMessage)) { w.WriteStartElement("htmlErrorMessage"); w.WriteCData(HtmlErrorMessage); w.WriteEndElement(); } // collections w.WriteCollectionIf("serverVariables", new HttpValuesCollection(ServerVariable)); w.WriteCollectionIf("queryString", new HttpValuesCollection(QueryString)); w.WriteCollectionIf("form", new HttpValuesCollection(Form)); w.WriteCollectionIf("cookies", new HttpValuesCollection(Cookie)); }