本文整理汇总了C#中System.Xml.XmlWriter.WriteEndAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteEndAttribute方法的具体用法?C# XmlWriter.WriteEndAttribute怎么用?C# XmlWriter.WriteEndAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteEndAttribute方法的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: 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();
}
示例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: 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();
}
示例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: 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();
}
示例7: 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");
}
示例8: InsertNode
private void InsertNode(XmlWriter writer, Item item) {
if (item.IsNamespaced) {
writer.WriteStartElement(item.LocalName, item.Namespace);
} else {
writer.WriteStartElement(item.LocalName);
}
foreach (Item.AttributeNode attr in item.Attributes) {
if (attr.IsNamespaced) {
writer.WriteStartAttribute(attr.LocalName, attr.Namespace);
writer.WriteAttributeString(attr.LocalName, attr.Namespace, attr.Value);
} else {
writer.WriteStartAttribute(attr.LocalName);
writer.WriteAttributeString(attr.LocalName, attr.Value);
}
writer.WriteEndAttribute();
}
if (item.HasContent) {
if (item.IsNamespaced) {
writer.WriteElementString(item.LocalName, item.Namespace, item.LocalValue.ToString());
} else {
writer.WriteElementString(item.LocalName, item.LocalValue.ToString());
}
}
if (item.HasChildren) {
foreach (Item child in item.Children) {
InsertNode(writer, child);
}
}
writer.WriteEndElement();
}
示例9: WriteLayout
private void WriteLayout(XmlWriter writer)
{
writer.WriteStartElement("Layout");
for (int i = 0; i < map.TileLayers.Count; i++)
{
writer.WriteStartElement("Layer");
writer.WriteStartAttribute("ID");
writer.WriteValue(i);
writer.WriteEndAttribute();
WriteRows(writer, map.TileLayers[i]);
writer.WriteEndElement();
}
writer.WriteStartElement("CustomLayer");
WriteRows(writer, map.CustomLayer);
writer.WriteEndElement();
writer.WriteEndElement();
}
示例10: SerializeNetwork
public override void SerializeNetwork(XmlWriter xmlWriter)
{
base.SerializeNetwork(xmlWriter);
xmlWriter.WriteStartAttribute("InputPortsCount");
xmlWriter.WriteValue(InputPorts.Count);
xmlWriter.WriteEndAttribute();
}
示例11: OnSave
public virtual void OnSave(XmlWriter writer)
{
Vector3 pos = Transformation.GetPosition();
Vector3 rot = Transformation.GetRotation();
Vector3 scale = Transformation.GetScale();
writer.WriteStartAttribute("position");
writer.WriteValue(ParseUtils.WriteVector3(pos));
writer.WriteEndAttribute();
writer.WriteStartAttribute("rotation");
writer.WriteValue(ParseUtils.WriteVector3(rot));
writer.WriteEndAttribute();
writer.WriteStartAttribute("scale");
writer.WriteValue(ParseUtils.WriteVector3(scale));
writer.WriteEndAttribute();
}
示例12: WriteAttribute
public static void WriteAttribute(XmlWriter xmlWriter, string name, object value)
{
if (value != null)
{
xmlWriter.WriteStartAttribute(name);
xmlWriter.WriteValue(value);
xmlWriter.WriteEndAttribute();
}
}
示例13: WriteXmlAttributes
protected internal override void WriteXmlAttributes(XmlWriter writer)
{
if (!string.IsNullOrEmpty(StartMeasure))
{
writer.WriteStartAttribute(StartMeasureField);
writer.WriteValue(StartMeasure);
writer.WriteEndAttribute();
}
if (!string.IsNullOrEmpty(EndMeasure))
{
writer.WriteStartAttribute(EndMeasureField);
writer.WriteValue(EndMeasure);
writer.WriteEndAttribute();
}
base.WriteXmlAttributes(writer);
}
示例14: SerializeNetwork
public override void SerializeNetwork(XmlWriter xmlWriter)
{
base.SerializeNetwork(xmlWriter);
var textBox = ControlElements[0] as TextBox;
if (textBox != null)
{
xmlWriter.WriteStartAttribute("Text");
xmlWriter.WriteValue(textBox.Text);
xmlWriter.WriteEndAttribute();
}
var checkBox = ControlElements[2] as CheckBox;
if (checkBox != null)
{
xmlWriter.WriteStartAttribute("CheckBoxIsChecked");
if (checkBox.IsChecked != null) xmlWriter.WriteValue(checkBox.IsChecked);
xmlWriter.WriteEndAttribute();
}
var comboBox = ControlElements[3] as ComboBox;
if (comboBox != null)
{
xmlWriter.WriteStartAttribute("SelectedIndex");
xmlWriter.WriteValue(comboBox.SelectedIndex);
xmlWriter.WriteEndAttribute();
}
var slider = ControlElements[4] as Slider;
if (slider != null)
{
xmlWriter.WriteStartAttribute("SliderMax");
xmlWriter.WriteValue(slider.Maximum);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("SliderMin");
xmlWriter.WriteValue(slider.Minimum);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("SliderValue");
xmlWriter.WriteValue(slider.Value);
xmlWriter.WriteEndAttribute();
}
}
示例15: SerializeNetwork
public override void SerializeNetwork(XmlWriter xmlWriter)
{
base.SerializeNetwork(xmlWriter);
var slider = ControlElements[0] as Slider;
if (slider == null) return;
xmlWriter.WriteStartAttribute("SliderMax");
xmlWriter.WriteValue(slider.Maximum);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("SliderMin");
xmlWriter.WriteValue(slider.Minimum);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("SliderValue");
xmlWriter.WriteValue(slider.Value);
xmlWriter.WriteEndAttribute();
}