本文整理汇总了C#中System.Xml.XmlWriter.WriteValue方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteValue方法的具体用法?C# XmlWriter.WriteValue怎么用?C# XmlWriter.WriteValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeNetwork
public override void SerializeNetwork(XmlWriter xmlWriter)
{
base.SerializeNetwork(xmlWriter);
var expander = ControlElements[0] as SliderExpanderDouble;
if (expander == null) return;
xmlWriter.WriteStartAttribute("SliderMax");
xmlWriter.WriteValue(expander.SliderMax);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("SliderMin");
xmlWriter.WriteValue(expander.SliderMin);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("SliderValue");
xmlWriter.WriteValue(expander.SliderValue);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("SliderStep");
xmlWriter.WriteValue(expander.SliderStep);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("IsExpanded");
xmlWriter.WriteValue(expander.IsExpanded);
xmlWriter.WriteEndAttribute();
}
示例2: GetDirectoryItemsWithXmlWriter
static void GetDirectoryItemsWithXmlWriter(string path, XmlWriter writer)
{
var dirInfo = new DirectoryInfo(path);
var files = dirInfo.GetFiles();
var subdirs = dirInfo.GetDirectories();
writer.WriteStartElement("dir");
writer.WriteStartAttribute("name");
writer.WriteValue(dirInfo.Name);
writer.WriteEndAttribute();
foreach (var file in files)
{
writer.WriteStartElement("file");
writer.WriteStartAttribute("name");
writer.WriteValue(file.Name);
writer.WriteEndAttribute();
writer.WriteEndElement();
}
foreach (var dir in subdirs)
{
GetDirectoryItemsWithXmlWriter(dir.FullName, writer);
}
writer.WriteEndElement();
}
示例3: Write
public void Write()
{
XmlWriterSettings xmlSetting = new XmlWriterSettings();
xmlSetting.CloseOutput = true;
xmlSetting.Encoding = Encoding.UTF8;
xmlSetting.Indent = true;
xmlSetting.NewLineChars = "\r\n";
wr = XmlWriter.Create(GeneralConfig.AppDataPath + "Questionaries\\" + questionary.Category + ".xml", xmlSetting);
wr.WriteStartDocument();
wr.WriteStartElement("Questionary");
wr.WriteStartAttribute("category");
wr.WriteValue(questionary.Category);
wr.WriteEndAttribute();
wr.WriteStartAttribute("created");
wr.WriteValue(questionary.Created.ToString());
wr.WriteEndAttribute();
wr.WriteStartAttribute("updated");
wr.WriteValue(questionary.Updated.ToString());
wr.WriteEndAttribute();
wr.WriteStartAttribute("template");
wr.WriteValue(questionary.TemplateId);
wr.WriteEndAttribute();
wr.WriteStartElement("Questions");
WriteQuestions();
wr.WriteEndElement();
wr.WriteEndElement();
wr.WriteEndDocument();
wr.Close();
}
示例4: WriteDirectoryInfo
private static void WriteDirectoryInfo(string directories, XmlWriter writer)
{
DirectoryInfo directoryInfo = new DirectoryInfo(directories);
FileInfo[] files = directoryInfo.GetFiles();
DirectoryInfo[] subDirectories = directoryInfo.GetDirectories();
writer.WriteStartElement("Dir");
writer.WriteStartAttribute("name");
writer.WriteValue(directoryInfo.Name);
writer.WriteEndAttribute();
foreach (var file in files)
{
writer.WriteStartElement("File");
writer.WriteStartAttribute("name");
writer.WriteValue(file.Name);
writer.WriteEndAttribute();
writer.WriteEndElement();
}
foreach (var dir in subDirectories)
{
WriteDirectoryInfo(dir.FullName, writer);
}
writer.WriteEndElement();
}
示例5: WriteXMLToAttributes
public void WriteXMLToAttributes(XmlWriter writer)
{
writer.WriteStartAttribute("lat");
writer.WriteValue(this.lat.ToString(CultureInfo.InvariantCulture));
writer.WriteEndAttribute();
writer.WriteStartAttribute("lon");
writer.WriteValue(this.lon.ToString(CultureInfo.InvariantCulture));
writer.WriteEndAttribute();
}
示例6: WriteXml
public override void WriteXml(XmlWriter writer)
{
writer.WriteStartElement("X");
writer.WriteValue(((Point)Value).X);
writer.WriteEndElement();
writer.WriteStartElement("Y");
writer.WriteValue(((Point)Value).Y);
writer.WriteEndElement();
}
示例7: WriteKey
static void WriteKey(XmlWriter handle, string keyName, string keyValue)
{
handle.WriteStartElement("Key");
handle.WriteStartAttribute("Name");
handle.WriteValue(keyName);
handle.WriteEndAttribute();
handle.WriteStartAttribute("Value");
handle.WriteValue(keyValue);
handle.WriteEndAttribute();
handle.WriteEndElement();
}
示例8: WriteXml
public void WriteXml(XmlWriter writer)
{
if (_value is DateTime)
{
writer.WriteValue(XmlConvert.ToString((DateTime)_value, DateSerializationFormat));
}
else
{
writer.WriteValue(XmlConvert.ToString((TimeSpan)_value));
}
}
示例9: AddEntry
private void AddEntry(XmlWriter writer, Package package, string baseUrl)
{
writer.WriteStartElement("entry");
writer.WriteElementString("id", package.ID);
writer.WriteStartElement("title");
writer.WriteAttributeString("type", "text");
writer.WriteValue(package.Name);
writer.WriteEndElement(); // title
writer.WriteStartElement("link");
writer.WriteAttributeString("rel", "alternate");
writer.WriteAttributeString("href", baseUrl + "/extensions/" + package.ID + "/extension.vsix");
writer.WriteEndElement(); // link
writer.WriteStartElement("summary");
writer.WriteAttributeString("type", "text");
writer.WriteValue(package.Description);
writer.WriteEndElement(); // summary
writer.WriteElementString("published", package.DatePublished.ToString("yyyy-MM-ddTHH:mm:ssZ"));
writer.WriteElementString("updated", package.DatePublished.ToString("yyyy-MM-ddTHH:mm:ssZ"));
writer.WriteStartElement("author");
writer.WriteElementString("name", package.Author);
writer.WriteEndElement(); // author
writer.WriteStartElement("content");
writer.WriteAttributeString("type", "application/octet-stream");
writer.WriteAttributeString("src", baseUrl + "/extensions/" + package.ID + "/extension.vsix");
writer.WriteEndElement(); // content
writer.WriteStartElement("link");
writer.WriteAttributeString("rel", "icon");
writer.WriteAttributeString("href", baseUrl + "/extensions/" + package.ID + "/" + package.Icon);
writer.WriteEndElement(); // icon
writer.WriteStartElement("link");
writer.WriteAttributeString("rel", "previewimage");
writer.WriteAttributeString("href", baseUrl + "/extensions/" + package.ID + "/" + package.Preview);
writer.WriteEndElement(); // preview
writer.WriteRaw("\r\n<Vsix xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://schemas.microsoft.com/developer/vsx-syndication-schema/2010\">\r\n");
writer.WriteElementString("Id", package.ID);
writer.WriteElementString("Version", package.Version);
writer.WriteStartElement("References");
writer.WriteEndElement();
writer.WriteRaw("</Vsix>");// Vsix
writer.WriteEndElement(); // entry
}
示例10: writeColumnMapping
private static void writeColumnMapping(XmlWriter writer, ColumnMapping columnMapping)
{
writer.WriteStartElement("ColumnMapping");
writer.WriteStartAttribute("type");
writer.WriteValue(columnMapping.GetType().Name);
writer.WriteEndAttribute();
writer.WriteStartAttribute("columnUse");
writer.WriteValue(columnMapping.ColumnUse.ToString());
writer.WriteEndAttribute();
writer.WriteStartAttribute("destinationColumnReference");
writer.WriteValue(columnMapping.DestinationColumn.Name);
writer.WriteEndAttribute();
if (columnMapping is ExcelColumnMapping)
{
var excelColumnMapping = (ExcelColumnMapping)columnMapping;
writer.WriteStartAttribute("sourceHeader");
writer.WriteValue(excelColumnMapping.SourceHeader);
writer.WriteEndAttribute();
}
else if (columnMapping is TableColumnMapping)
{
var tableColumnMapping = (TableColumnMapping)columnMapping;
writer.WriteStartAttribute("sourceTableMappingIndex");
writer.WriteValue(tableColumnMapping.SourceTableMapping.Index);
writer.WriteEndAttribute();
writer.WriteStartAttribute("sourceColumnReference");
writer.WriteValue(tableColumnMapping.SourceColumn.Name);
writer.WriteEndAttribute();
}
else if (columnMapping is LiteralColumnMapping)
{
var literalColumnMapping = (LiteralColumnMapping)columnMapping;
writer.WriteStartAttribute("literal");
writer.WriteValue(literalColumnMapping.Literal);
writer.WriteEndAttribute();
writer.WriteStartAttribute("literalType");
writer.WriteValue(literalColumnMapping.LiteralType.ToString());
writer.WriteEndAttribute();
}
writer.WriteEndElement();
writer.WriteRaw("\n");
}
示例11: WriteXml
public void WriteXml(XmlWriter writer)
{
writer.WriteStartElement(TransliterationSettingsElementName);
writer.WriteStartElement(ModeElementName);
writer.WriteValue(Mode.ToString());
writer.WriteEndElement();
writer.WriteStartElement(FileNameElementName);
writer.WriteValue(FileName);
writer.WriteEndElement();
writer.WriteEndElement();
}
示例12: WriteElement
public void WriteElement(IAixmConverter converter, int flow, JObject feature, XmlWriter writer)
{
var id = feature["properties"]["id"];
if (flow == 0)
{
if (id != null)
{
if (id is JObject)
{
writer.WriteStartElement("gml", "identifier", null);
var obj = id as JObject;
foreach(var prop in obj.Properties().Where(p=>p.Name.StartsWith("@")))
{
writer.WriteAttributeString(prop.Name.Substring(1), prop.Value.ToString());
}
writer.WriteValue(id["#text"].ToString());
writer.WriteEndElement();
}else{
writer.WriteElementString("gml", "identifier", null, id.ToString());
}
}
}
else
{
}
}
示例13: SerializeAnalyticsSettings
/// <summary>
/// Write the settings provided to stream
/// </summary>
/// <param name="inputStream"></param>
/// <returns></returns>
public static void SerializeAnalyticsSettings(XmlWriter xmlWriter, AnalyticsSettings settings)
{
xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement(SettingsSerializerHelper.RootPropertiesElementName);
//LOGGING STARTS HERE
xmlWriter.WriteStartElement(SettingsSerializerHelper.LoggingElementName);
xmlWriter.WriteStartElement(SettingsSerializerHelper.VersionElementName);
xmlWriter.WriteValue(settings.LogVersion);
xmlWriter.WriteEndElement();
bool isReadEnabled = (settings.LogType & LoggingLevel.Read) != LoggingLevel.None;
xmlWriter.WriteStartElement(SettingsSerializerHelper.ApiTypeReadElementName);
xmlWriter.WriteValue(isReadEnabled);
xmlWriter.WriteEndElement();
bool isWriteEnabled = (settings.LogType & LoggingLevel.Write) != LoggingLevel.None;
xmlWriter.WriteStartElement(SettingsSerializerHelper.ApiTypeWriteElementName);
xmlWriter.WriteValue(isWriteEnabled);
xmlWriter.WriteEndElement();
bool isDeleteEnabled = (settings.LogType & LoggingLevel.Delete) != LoggingLevel.None;
xmlWriter.WriteStartElement(SettingsSerializerHelper.ApiTypeDeleteElementName);
xmlWriter.WriteValue(isDeleteEnabled);
xmlWriter.WriteEndElement();
SerializeRetentionPolicy(xmlWriter, settings.IsLogRetentionPolicyEnabled, settings.LogRetentionInDays);
xmlWriter.WriteEndElement(); // logging element
//METRICS STARTS HERE
xmlWriter.WriteStartElement(SettingsSerializerHelper.MetricsElementName);
xmlWriter.WriteStartElement(SettingsSerializerHelper.VersionElementName);
xmlWriter.WriteValue(settings.MetricsVersion);
xmlWriter.WriteEndElement();
bool isServiceSummaryEnabled = (settings.MetricsType & MetricsType.ServiceSummary) != MetricsType.None;
xmlWriter.WriteStartElement(SettingsSerializerHelper.MetricsEnabledElementName);
xmlWriter.WriteValue(isServiceSummaryEnabled);
xmlWriter.WriteEndElement();
if (isServiceSummaryEnabled)
{
bool isApiSummaryEnabled = (settings.MetricsType & MetricsType.ApiSummary) != MetricsType.None;
xmlWriter.WriteStartElement(SettingsSerializerHelper.IncludeApiSummaryElementName);
xmlWriter.WriteValue(isApiSummaryEnabled);
xmlWriter.WriteEndElement();
}
SerializeRetentionPolicy(
xmlWriter,
settings.IsMetricsRetentionPolicyEnabled,
settings.MetricsRetentionInDays);
xmlWriter.WriteEndElement();
// metrics
xmlWriter.WriteEndElement();
// root element
xmlWriter.WriteEndDocument();
}
示例14: Save
internal override void Save (XmlWriter writer)
{
writer.WriteStartElement (XmlName);
if (!string.IsNullOrWhiteSpace (Value))
writer.WriteValue (Value);
writer.WriteEndElement ();
}
示例15: SerializeToXML
public override void SerializeToXML(XmlWriter writer)
{
writer.WriteStartElement("Loop");
foreach (ParamInputModel param in Activity.InputParam)
{
string paramValue = param.Value != null ? param.Value.ToString() : param.ValueStr == null ? param.ValueStr : null;
if (paramValue != null)
{
writer.WriteStartElement(param.IsInputParam ? "InboundParam" : "OutboundParam");
writer.WriteAttributeString("name", param.Name);
writer.WriteAttributeString("type", param.DataType);
writer.WriteStartElement("Value");
writer.WriteValue(paramValue); //todo
writer.WriteEndElement();
writer.WriteEndElement();
}
}
writer.WriteAttributeString("cycles", "0");
writer.WriteAttributeString("increment", "1");
foreach (StandardFlowModel activity in NestedModels)
{
activity.SerializeToXML(writer);
}
writer.WriteEndElement();
}