本文整理汇总了C#中System.Xml.XmlWriter.WriteElementString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteElementString方法的具体用法?C# XmlWriter.WriteElementString怎么用?C# XmlWriter.WriteElementString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteElementString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteAlbum
private static void WriteAlbum(XmlWriter writer, string albumTitle, string artist)
{
writer.WriteStartElement("album");
writer.WriteElementString("title", albumTitle);
writer.WriteElementString("artist", artist);
writer.WriteEndElement();
}
示例2: WriteTo
internal override void WriteTo(XmlWriter xml)
{
if (xml == null)
return;
xml.WriteComment(SR.GetString(SR.ServiceNameFromClient));
xml.WriteElementString("ServiceName", this.serviceBindingNameSentByClient);
xml.WriteComment(SR.GetString(SR.ServiceNameOnService));
xml.WriteStartElement("ServiceNameCollection");
if (this.serviceNameCollectionConfiguredOnServer == null || this.serviceNameCollectionConfiguredOnServer.Count < 1)
{
xml.WriteElementString("ServiceName", this.defaultServiceBindingNameOfServer);
}
else
{
foreach (string serviceName in this.serviceNameCollectionConfiguredOnServer)
{
xml.WriteElementString("ServiceName", serviceName);
}
}
xml.WriteFullEndElement();
}
示例3: WriteXml
public void WriteXml(XmlWriter writer)
{
writer.WriteStartElement("key");
writer.WriteElementString("fifths", Fifths.ToInvariantString());
writer.WriteElementString("mode", Mode.ToLowerInvariantString());
writer.WriteEndElement();
}
示例4: WriteTo
internal override void WriteTo(XmlWriter writer)
{
base.WriteTo(writer);
writer.WriteElementString("MeshId", this.meshId.ToString());
writer.WriteElementString("MessageSource", this.from.ToString());
writer.WriteElementString("Exception", this.exception.Message);
}
示例5: WriteCustomElements
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
{
var imdb = item.GetProviderId(MetadataProviders.Imdb);
if (!string.IsNullOrEmpty(imdb))
{
writer.WriteElementString("id", imdb);
}
var musicVideo = item as MusicVideo;
if (musicVideo != null)
{
if (!string.IsNullOrEmpty(musicVideo.Artist))
{
writer.WriteElementString("artist", musicVideo.Artist);
}
if (!string.IsNullOrEmpty(musicVideo.Album))
{
writer.WriteElementString("album", musicVideo.Album);
}
}
var movie = item as Movie;
if (movie != null)
{
if (!string.IsNullOrEmpty(movie.TmdbCollectionName))
{
writer.WriteElementString("set", movie.TmdbCollectionName);
}
}
}
示例6: ON2XML
/// <summary>
/// Creates XML elements from the data of the system.
/// </summary>
/// <param name="xmlWriter">Object with the XML message to add new information and return to client side</param>
/// <param name="val">Value to be puted inside the XML message</param>
/// <param name="dtdVersion">Version of the DTD that follows the XML message</param>
/// <param name="xmlElement">Element of the XML that is checked</param>
public static void ON2XML(XmlWriter xmlWriter, ONDateTime val, double dtdVersion, string xmlElement)
{
if (val == null)
{
if (xmlElement == ONXml.XMLTAG_V)
xmlWriter.WriteElementString(xmlElement, "");
else
xmlWriter.WriteElementString(ONXml.XMLTAG_NULL, null);
}
else
{
if (dtdVersion < 2.0) // Apply the locale format
xmlWriter.WriteElementString(xmlElement, val.TypedValue.ToString());
else
{
xmlWriter.WriteStartElement(xmlElement);
if (xmlElement == ONXml.XMLTAG_OIDFIELD && dtdVersion > 2.0)
xmlWriter.WriteAttributeString("Type", "datetime");
if (val.TypedValue.Millisecond == 0)
xmlWriter.WriteString(val.TypedValue.ToString("yyyy-MM-ddTHH:mm:ss"));
else
xmlWriter.WriteString(val.TypedValue.ToString("yyyy-MM-ddTHH:mm:ss.fff"));
xmlWriter.WriteEndElement();
}
}
}
示例7: WriteItemBody
// Write just the body (InnerXml) of a new item
public static void WriteItemBody(XmlWriter w, string title, string content, System.Uri link, DateTime time)
{
w.WriteElementString("title", title);
if (link != null) { w.WriteElementString("link", link.ToString()); }
w.WriteElementString("description", content); // this will escape
w.WriteElementString("pubDate", ConvertDate(time));
}
示例8: WriteXml
public void WriteXml(XmlWriter writer)
{
string namespaceUrl = string.Empty;
foreach (var mapping in _mappings)
{
writer.WriteStartElement(mapping.GetType().Name);
writer.WriteElementString(DataLoaderConstants.TableColumnsMetadataColumn, mapping.Column);
writer.WriteElementString(DataLoaderConstants.TableColumnsMetadataColumnSemantic, mapping.ColumnSemantic);
if (mapping.ColumnSemantic == string.Empty)
{
if (!ValidateNamespace(mapping.ColumnNamespace))
mapping.ColumnNamespace = "ogdi=ogdiUrl";
if (mapping.ColumnNamespace.Contains('"'))
namespaceUrl = mapping.ColumnNamespace.Replace("\"", "");
else
namespaceUrl = mapping.ColumnNamespace;
writer.WriteElementString(DataLoaderConstants.TableColumnsMetadataColumnNamespace, namespaceUrl);
writer.WriteElementString(DataLoaderConstants.TableColumnsMetadataColumnDescription, mapping.ColumnDescription);
}
else
{
namespaceUrl = ReadNamespace(mapping.ColumnSemantic);
writer.WriteElementString(DataLoaderConstants.TableColumnsMetadataColumnNamespace, namespaceUrl);
writer.WriteElementString(DataLoaderConstants.TableColumnsMetadataColumnDescription, "");
}
writer.WriteEndElement();
}
}
示例9: AddTracks
private void AddTracks(IEnumerable<Audio> tracks, XmlWriter writer)
{
foreach (var track in tracks.OrderBy(i => i.ParentIndexNumber ?? 0)
.ThenBy(i => i.IndexNumber ?? 0))
{
writer.WriteStartElement("track");
if (track.IndexNumber.HasValue)
{
writer.WriteElementString("position", track.IndexNumber.Value.ToString(UsCulture));
}
if (!string.IsNullOrEmpty(track.Name))
{
writer.WriteElementString("title", track.Name);
}
if (track.RunTimeTicks.HasValue)
{
var time = TimeSpan.FromTicks(track.RunTimeTicks.Value).ToString(@"mm\:ss");
writer.WriteElementString("duration", time);
}
writer.WriteEndElement();
}
}
示例10: AddExceptionToTraceString
private void AddExceptionToTraceString(XmlWriter xml, Exception exception)
{
xml.WriteElementString("ExceptionType", XmlUtility.Encode(exception.GetType().AssemblyQualifiedName));
xml.WriteElementString("Message", XmlUtility.Encode(exception.Message));
xml.WriteElementString("StackTrace", XmlUtility.Encode(StackTraceString(exception)));
xml.WriteElementString("ExceptionString", XmlUtility.Encode(exception.ToString()));
var exception2 = exception as Win32Exception;
if (exception2 != null)
{
xml.WriteElementString("NativeErrorCode",
exception2.NativeErrorCode.ToString("X", CultureInfo.InvariantCulture));
}
if ((exception.Data != null) && (exception.Data.Count > 0))
{
xml.WriteStartElement("DataItems");
foreach (object obj2 in exception.Data.Keys)
{
xml.WriteStartElement("Data");
xml.WriteElementString("Key", XmlUtility.Encode(obj2.ToString()));
xml.WriteElementString("Value", XmlUtility.Encode(exception.Data[obj2].ToString()));
xml.WriteEndElement();
}
xml.WriteEndElement();
}
if (exception.InnerException != null)
{
xml.WriteStartElement("InnerException");
AddExceptionToTraceString(xml, exception.InnerException);
xml.WriteEndElement();
}
}
示例11: ON2XML
/// <summary>
/// Creates XML elements from the data of the system.
/// </summary>
/// <param name="xmlWriter">Object with the XML message to add new information and return to client side</param>
/// <param name="val">Value to be puted inside the XML message</param>
/// <param name="dtdVersion">Version of the DTD that follows the XML message</param>
/// <param name="xmlElement">Element of the XML that is checked</param>
public static void ON2XML(XmlWriter xmlWriter, ONReal val, double dtdVersion, string xmlElement)
{
if (val == null)
{
if (xmlElement == ONXml.XMLTAG_V)
xmlWriter.WriteElementString(xmlElement, "");
else
xmlWriter.WriteElementString(ONXml.XMLTAG_NULL, null);
}
else
{
if (dtdVersion < 2.0) // Apply the locale format
xmlWriter.WriteElementString(xmlElement, val.TypedValue.ToString("0.##############"));
else
{
xmlWriter.WriteStartElement(xmlElement);
if (xmlElement == ONXml.XMLTAG_OIDFIELD && dtdVersion > 2.0)
xmlWriter.WriteAttributeString("Type", "real");
string lValue = Pack(val);
xmlWriter.WriteString(lValue);
xmlWriter.WriteEndElement();
}
}
}
示例12: WriteEffectContents
private void WriteEffectContents(EffectInfo effect, XmlWriter writer)
{
if (!string.IsNullOrWhiteSpace(effect.Name))
writer.WriteAttributeString("name", effect.Name);
if (effect.Filter != null)
{
writer.WriteStartElement("EntityFilter");
if (effect.Filter.Type != null)
writer.WriteElementString("Type", effect.Filter.Type);
if (effect.Filter.Direction != null)
writer.WriteElementString("Direction", effect.Filter.Direction.ToString());
if (effect.Filter.Position != null)
{
if (effect.Filter.Position.X != null)
WriteRangeFilter("X", writer, effect.Filter.Position.X);
if (effect.Filter.Position.Y != null)
WriteRangeFilter("Y", writer, effect.Filter.Position.Y);
}
writer.WriteEndElement();
}
foreach (var part in effect.Parts)
WritePart(part, writer);
}
示例13: WriteXml
public void WriteXml(XmlWriter writer)
{
writer.WriteElementString("api-key", ApiKey);
if (RecipeID.HasValue)
{
writer.WriteElementString("recipe-id", RecipeID.Value.ToString());
}
if (RecipeName != null)
{
writer.WriteElementString("recipe-name", RecipeName);
}
if (NotificationUrl != null)
{
writer.WriteElementString("notification-url", NotificationUrl);
}
if (PassThrough != null)
{
writer.WriteElementString("pass-through", PassThrough);
}
if (CuePoints.Event.Count > 0 || CuePoints.Navigation.Count > 0)
{
writer.WriteStartElement("cue-points");
CuePoints.WriteXml(writer);
writer.WriteEndElement();
}
writer.WriteStartElement("file-locations");
Locations.WriteXml(writer);
writer.WriteEndElement();
}
示例14: Write
public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context)
{
// TODO: merge common code with C# PropertiesSection
writer.WriteStartElement("PropertyGroup");
writer.WriteAttributeString("Condition", " '$(Configuration)|$(Platform)' == 'Bari|Bari' ");
WriteConfigurationSpecificPart(writer, project);
writer.WriteEndElement();
writer.WriteStartElement("PropertyGroup");
WriteConfigurationSpecificPart(writer, project);
writer.WriteElementString("OutputType", GetOutputType(project.Type));
writer.WriteElementString("AssemblyName", project.Name);
writer.WriteElementString("ProjectGuid", projectGuidManagement.GetGuid(project).ToString("B"));
FsharpProjectParameters parameters = project.HasParameters("fsharp")
? project.GetParameters<FsharpProjectParameters>("fsharp")
: new FsharpProjectParameters(Suite);
parameters.FillProjectSpecificMissingInfo(project);
parameters.ToFsprojProperties(writer);
writer.WriteEndElement();
}
示例15: WriteTo
internal override void WriteTo(XmlWriter writer)
{
base.WriteTo(writer);
writer.WriteElementString("PeerName", this.peerName);
writer.WriteElementString("CloudName", this.cloudName);
writer.WriteElementString("Exception", this.exception.ToString());
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:PnrpResolveExceptionTraceRecord.cs