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(); }
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(); }
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(); }
public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteElementString("aggregate", Aggregate.ToString().ToLowerInvariant()); if (Assemblies != null) { writer.WriteStartElement("assemblies"); foreach (var assembly in Assemblies) { writer.WriteStartElement("assembly"); writer.WriteStartAttribute("ref"); writer.WriteString(assembly); writer.WriteEndAttribute(); writer.WriteEndElement(); } writer.WriteEndElement(); } if (Dependencies != null) { writer.WriteStartElement("dependencies"); foreach (var dependency in Dependencies) { writer.WriteStartElement("dependency"); writer.WriteStartAttribute("ref"); writer.WriteString(dependency); writer.WriteEndAttribute(); writer.WriteEndElement(); } writer.WriteEndElement(); } }
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(); }
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(); }
public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("Url", Url); writer.WriteAttributeString("ServiceName", ServiceName); writer.WriteStartAttribute("HostedServiceProperties"); writer.WriteEndAttribute(); writer.WriteStartAttribute("Deployments"); writer.WriteEndAttribute(); }
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(); }
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"); }
public bool writeAttributeNs(string prefix, string name, string uri, string content) { if (!StartAttributeHelper()) { return(false); } // WriteAttributeString does not escape " bool res = true; res &= CheckedCall(() => _writer.WriteStartAttribute(prefix, name, uri)); res &= CheckedCall(() => _writer.WriteRaw(content.Escape())); res &= CheckedCall(() => _writer.WriteEndAttribute()); return(res); }
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(); }
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(); }
public override void SerializeNetwork(XmlWriter xmlWriter) { base.SerializeNetwork(xmlWriter); xmlWriter.WriteStartAttribute("InputPortsCount"); xmlWriter.WriteValue(InputPorts.Count); xmlWriter.WriteEndAttribute(); }
public virtual void WriteXml(System.Xml.XmlWriter writer) { writer.WriteStartElement("WriteStartAttribute"); writer.WriteStartAttribute("wsa", "WriteStartAttribute", "WriteStartAttributeNS"); // bug 18930 writer.WriteEndAttribute(); writer.WriteEndElement(); //WriteStartAttribute }
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(); }
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); }
public static void WriteAttribute(XmlWriter xmlWriter, string name, object value) { if (value != null) { xmlWriter.WriteStartAttribute(name); xmlWriter.WriteValue(value); xmlWriter.WriteEndAttribute(); } }
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(); } }
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(); }
public void WriteXml(XmlWriter writer) { writer.WriteElementString("Keywords", string.Join(" ", Keywords.ToArray())); writer.WriteStartAttribute("Snippets"); foreach (var snippet in Snippets) snippet.WriteXml(writer); writer.WriteEndAttribute(); }
public override void SerializeNetwork(XmlWriter xmlWriter) { base.SerializeNetwork(xmlWriter); var controlElement = ControlElements[0] as ComboBox; if (controlElement == null) return; xmlWriter.WriteStartAttribute("TypeName"); xmlWriter.WriteValue(_typeComboBox.Name); xmlWriter.WriteEndAttribute(); }
public override void SerializeNetwork(XmlWriter xmlWriter) { base.SerializeNetwork(xmlWriter); var textBox = ControlElements[0] as TextBox; if (textBox == null) return; xmlWriter.WriteStartAttribute("Text"); xmlWriter.WriteValue(textBox.Text); xmlWriter.WriteEndAttribute(); }
protected internal override void WriteXmlAttributes(XmlWriter writer) { base.WriteXmlAttributes(writer); if (MaxRender != int.MaxValue) { writer.WriteStartAttribute(MaxRenderField); writer.WriteValue(MaxRender); writer.WriteEndAttribute(); } }
public override void SerializeNetwork(XmlWriter xmlWriter) { base.SerializeNetwork(xmlWriter); var textBox = ControlElements[0] as ToggleButton; if (textBox == null) return; xmlWriter.WriteStartAttribute("Boolean"); xmlWriter.WriteValue(toggleButton.IsChecked.ToString()); xmlWriter.WriteEndAttribute(); }
protected internal override void WriteXmlAttributes(XmlWriter writer) { base.WriteXmlAttributes(writer); if (SmoothingMode != DefaultSmoothingMode) { writer.WriteStartAttribute(AntiAliasField); writer.WriteValue(SmoothingMode); writer.WriteEndAttribute(); } }
public void WriteExcelColumnDefinition(int columnWidth) { if (_writer == null) { throw new InvalidOperationException("Cannot write after closing."); } _writer.WriteStartElement("Column", "urn:schemas-microsoft-com:office:spreadsheet"); _writer.WriteStartAttribute("Width", "urn:schemas-microsoft-com:office:spreadsheet"); _writer.WriteValue(columnWidth); _writer.WriteEndAttribute(); _writer.WriteEndElement(); }
public virtual void WriteGameObjectData(XmlWriter xmlWriter) { Type gameObjectType = GetType(); BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; FieldInfo[] fieldsOfGameObject = gameObjectType.GetFields(bindingFlags); foreach (FieldInfo fieldOfGameObject in fieldsOfGameObject) { object[] gameDataAttributes = fieldOfGameObject.GetCustomAttributes(typeof(GameDataAttribute), false); if (gameDataAttributes.Length > 0) { if (gameDataAttributes.Length > 1) { throw new Exception("You can only have one GameDataAttribute on any given Field."); } object objectWithAttribute = fieldOfGameObject.GetValue(this); if (objectWithAttribute != null) { var singleGameDataAttribute = (GameDataAttribute)gameDataAttributes[0]; String Name = singleGameDataAttribute.Name; if (Name.Contains(" ")) { throw new Exception(ToString() + " : '" + Name + "' has a space. Attribute names con not contain spaces."); } xmlWriter.WriteStartElement(Name); GameDataAttribute.WriteTypeAttributes(xmlWriter, objectWithAttribute); xmlWriter.WriteEndAttribute(); if (objectWithAttribute == null) { throw new Exception(ToString() + " : " + fieldOfGameObject.ToString() + " must have a default value.\n" + "\n" + "All data marked as [GameData] must be a primitive or a struct or if a class have a DEFALT value or filed initializer."); } if (objectWithAttribute is GameObject) { ((GameObject)objectWithAttribute).WriteGameObjectData(xmlWriter); } else { singleGameDataAttribute.WriteField(xmlWriter, objectWithAttribute); } xmlWriter.WriteEndElement(); } } } }
public void SaveXml(CompilationUnit cu) { try { this.cu = cu; is_assembly = cu.SyntaxTree is SyntaxTree.program_module || Compiler.is_dll(cu.SyntaxTree); XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = Encoding.UTF8; settings.Indent = true; xtw = XmlTextWriter.Create(Path.ChangeExtension(cu.UnitName, ".xml"), settings); unit_name = Path.GetFileNameWithoutExtension(cu.UnitName); xtw.WriteStartDocument(); xtw.WriteStartElement("doc"); if (is_assembly) { xtw.WriteStartElement("assembly"); xtw.WriteStartElement("name"); xtw.WriteString(Path.GetFileNameWithoutExtension(cu.UnitName)); xtw.WriteEndElement(); xtw.WriteEndElement(); } else { xtw.WriteStartElement("unit"); xtw.WriteStartAttribute("name"); //xtw.WriteString((cu.SemanticTree as common_unit_node).unit_name); xtw.WriteString(Path.GetFileNameWithoutExtension(cu.UnitName)); xtw.WriteEndAttribute(); xtw.WriteString(cu.SemanticTree.documentation); xtw.WriteEndElement(); } SaveMembers(); xtw.WriteEndElement(); xtw.Flush(); } catch (Exception e) { } try { if (xtw != null) xtw.Close(); } catch { } }
public void WriteXml(XmlWriter writer) { writer.WriteStartElement("Professionbuddy"); PrioritySelector ps = (PrioritySelector)DecoratedChild; writer.WriteStartAttribute("ChildrenCount"); writer.WriteValue(ps.Children.Count); writer.WriteEndAttribute(); foreach (IPBComposite comp in ps.Children) { writer.WriteStartElement(comp.GetType().Name); ((IXmlSerializable)comp).WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); }
public override void SerializeNetwork(XmlWriter xmlWriter) { base.SerializeNetwork(xmlWriter); var color = new Color(); if (cc.SelectedColor != null) color = cc.SelectedColor.Value; var drawingColor = System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B); xmlWriter.WriteStartAttribute("Color"); xmlWriter.WriteValue(ColorTranslator.ToHtml(drawingColor)); xmlWriter.WriteEndAttribute(); }
/// <summary> /// Report trace information as XML /// </summary> /// <param name="writer"></param> public void ToXml(XmlWriter writer) { writer.WriteStartElement("WordGrammarAttempt"); writer.WriteStartAttribute("success"); writer.WriteValue(m_fSuccess ? "true" : "false"); writer.WriteEndAttribute(); writer.WriteStartElement("Id"); writer.WriteValue(m_id); writer.WriteEndElement(); string sType = "pfx"; // try to guess morph type based on word type foreach (PcPatrMorph morph in m_morphs) { writer.WriteStartElement("Morphs"); string sWordType = morph.wordType; writer.WriteStartAttribute("wordType"); writer.WriteValue(sWordType); writer.WriteEndAttribute(); writer.WriteStartAttribute("type"); if (sType == "pfx" && sWordType == "root") sType = "root"; else if (sType == "root" && sWordType != "root") sType = "sfx"; writer.WriteValue(sType); writer.WriteEndAttribute(); writer.WriteStartAttribute("alloid"); writer.WriteValue(morph.formId); writer.WriteEndAttribute(); writer.WriteStartAttribute("morphname"); writer.WriteValue(morph.msaId); writer.WriteEndAttribute(); writer.WriteStartElement("alloform"); writer.WriteValue(morph.form); writer.WriteEndElement(); // Form //writer.WriteStartElement("Msa"); //writer.WriteEndElement(); // Msa writer.WriteStartElement("Gloss"); writer.WriteValue(morph.gloss); writer.WriteEndElement(); // Gloss writer.WriteEndElement(); // Morphs } writer.WriteEndElement(); }
/// <summary> /// Implements a custom serialization of the key, using the type name as a specifier. /// </summary> /// <param name="writer"></param> /// <param name="key"></param> protected override void SerializeKey(System.Xml.XmlWriter writer, Type key) { writer.WriteStartElement(SerializedKeyElementName); if (SerializeKeyTypeAsKeyAttribute) { writer.WriteStartAttribute("type"); writer.WriteValue("System.String"); writer.WriteEndAttribute(); } var typeFullName = key.FullName; if (!typeFullName.Contains(",")) { typeFullName += ", " + key.Assembly.GetName().Name; } writer.WriteRaw(XmlUtility.EncodeText(typeFullName)); writer.WriteEndElement(); }
public void SaveToFile(XmlWriter writer) { writer.WriteStartDocument(); writer.WriteStartElement("ParticleSystem"); writer.WriteStartAttribute("Name"); writer.WriteValue(name); writer.WriteEndAttribute(); foreach (ParticleEffect effect in effects) { effect.SaveToFile(writer); } writer.WriteEndElement(); /* Finish the document out */ writer.WriteEndDocument(); }
private void FormatAttribute(System.Xml.XmlWriter writer, IStream <Token <MarkupTokenType> > stream) { Token <MarkupTokenType> token = stream.Peek(); writer.WriteStartAttribute(token.Name.Prefix, token.Name.LocalName, token.Name.NamespaceUri); stream.Pop(); token = stream.Peek(); switch (token.TokenType) { case MarkupTokenType.Primitive: { ITextFormattable <MarkupTokenType> formattable = token.Value as ITextFormattable <MarkupTokenType>; if (formattable != null) { formattable.Format(this, new XmlWriterAdapter(writer)); } else { writer.WriteString(token.ValueAsString()); } break; } default: { throw new TokenException <MarkupTokenType>( token, String.Format(ErrorUnexpectedToken, token)); } } stream.Pop(); writer.WriteEndAttribute(); }
internal void WriteDecl(XmlWriter writer, XmlRawWriter rawWriter) { Debug.Assert(kind == NamespaceKind.NeedToWrite); if (null != rawWriter) { rawWriter.WriteNamespaceDeclaration(prefix, namespaceUri); } else { if (prefix.Length == 0) { writer.WriteStartAttribute(string.Empty, XmlConst.NsXmlNs, XmlConst.ReservedNsXmlNs); } else { writer.WriteStartAttribute(XmlConst.NsXmlNs, prefix, XmlConst.ReservedNsXmlNs); } writer.WriteString(namespaceUri); writer.WriteEndAttribute(); } }
public override void WriteTo(XmlWriter w) { w.WriteStartAttribute(this.Prefix, this.LocalName, this.NamespaceURI); this.WriteContentTo(w); w.WriteEndAttribute(); }
// Saves the node to the specified XmlWriter. public override void WriteTo(XmlWriter w) { w.WriteStartAttribute( Prefix, LocalName, NamespaceURI ); WriteContentTo(w); w.WriteEndAttribute(); }
private void WriteColWidthsXML(string thingName, XmlWriter writer) { ListView lv = this.ListViewByName(thingName); if (lv == null) return; writer.WriteStartElement("ColumnWidths"); writer.WriteStartAttribute("For"); writer.WriteValue(thingName); writer.WriteEndAttribute(); foreach (ColumnHeader lvc in lv.Columns) { writer.WriteStartElement("Width"); writer.WriteValue(lvc.Width); writer.WriteEndElement(); } writer.WriteEndElement(); // columnwidths }
public static void WriteAttribute(this XmlWriter xw, string localName, object value) { xw.WriteStartAttribute(localName); xw.WriteValue(value); xw.WriteEndAttribute(); }
public override void WriteEndAttribute() { w.WriteEndAttribute(); }
public void EventsToWriter(XmlWriter writer) { if (this.singleText.Count != 0) { writer.WriteString(this.singleText.GetResult()); } else { XmlRawWriter writer2 = writer as XmlRawWriter; for (int i = 0; i < this.pages.Count; i++) { XmlEvent[] eventArray = this.pages[i]; for (int j = 0; j < eventArray.Length; j++) { byte[] buffer; switch (eventArray[j].EventType) { case XmlEventType.Unknown: return; case XmlEventType.DocType: { writer.WriteDocType(eventArray[j].String1, eventArray[j].String2, eventArray[j].String3, (string)eventArray[j].Object); continue; } case XmlEventType.StartElem: { writer.WriteStartElement(eventArray[j].String1, eventArray[j].String2, eventArray[j].String3); continue; } case XmlEventType.StartAttr: { writer.WriteStartAttribute(eventArray[j].String1, eventArray[j].String2, eventArray[j].String3); continue; } case XmlEventType.EndAttr: { writer.WriteEndAttribute(); continue; } case XmlEventType.CData: { writer.WriteCData(eventArray[j].String1); continue; } case XmlEventType.Comment: { writer.WriteComment(eventArray[j].String1); continue; } case XmlEventType.PI: { writer.WriteProcessingInstruction(eventArray[j].String1, eventArray[j].String2); continue; } case XmlEventType.Whitespace: { writer.WriteWhitespace(eventArray[j].String1); continue; } case XmlEventType.String: { writer.WriteString(eventArray[j].String1); continue; } case XmlEventType.Raw: { writer.WriteRaw(eventArray[j].String1); continue; } case XmlEventType.EntRef: { writer.WriteEntityRef(eventArray[j].String1); continue; } case XmlEventType.CharEnt: { writer.WriteCharEntity((char)eventArray[j].Object); continue; } case XmlEventType.SurrCharEnt: { char[] chArray = (char[])eventArray[j].Object; writer.WriteSurrogateCharEntity(chArray[0], chArray[1]); continue; } case XmlEventType.Base64: { buffer = (byte[])eventArray[j].Object; writer.WriteBase64(buffer, 0, buffer.Length); continue; } case XmlEventType.BinHex: { buffer = (byte[])eventArray[j].Object; writer.WriteBinHex(buffer, 0, buffer.Length); continue; } case XmlEventType.XmlDecl1: { if (writer2 != null) { writer2.WriteXmlDeclaration((XmlStandalone)eventArray[j].Object); } continue; } case XmlEventType.XmlDecl2: { if (writer2 != null) { writer2.WriteXmlDeclaration(eventArray[j].String1); } continue; } case XmlEventType.StartContent: { if (writer2 != null) { writer2.StartElementContent(); } continue; } case XmlEventType.EndElem: { if (writer2 == null) { break; } writer2.WriteEndElement(eventArray[j].String1, eventArray[j].String2, eventArray[j].String3); continue; } case XmlEventType.FullEndElem: { if (writer2 == null) { goto Label_0367; } writer2.WriteFullEndElement(eventArray[j].String1, eventArray[j].String2, eventArray[j].String3); continue; } case XmlEventType.Nmsp: { if (writer2 == null) { goto Label_0394; } writer2.WriteNamespaceDeclaration(eventArray[j].String1, eventArray[j].String2); continue; } case XmlEventType.EndBase64: { if (writer2 != null) { writer2.WriteEndBase64(); } continue; } case XmlEventType.Close: { writer.Close(); continue; } case XmlEventType.Flush: { writer.Flush(); continue; } case XmlEventType.Dispose: { writer.Dispose(); continue; } default: { continue; } } writer.WriteEndElement(); continue; Label_0367: writer.WriteFullEndElement(); continue; Label_0394: writer.WriteAttributeString("xmlns", eventArray[j].String1, "http://www.w3.org/2000/xmlns/", eventArray[j].String2); } } } }
public override void WriteEndAttribute() { writer.WriteEndAttribute(); state = WriteState.Element; }
// Saves the node to the specified XmlWriter. public override void WriteTo(XmlWriter w) { w.WriteStartAttribute(Prefix, LocalName, NamespaceURI); WriteContentTo(w); w.WriteEndAttribute(); }
public override void WriteEndAttribute() { CheckAsync(); _coreWriter.WriteEndAttribute(); }
public override void WriteEndAttribute() { _inAttr = false; _wrapped.WriteEndAttribute(); }
/// <summary> /// Replay all cached events to an XmlWriter. /// </summary> public void EventsToWriter(XmlWriter writer) { XmlEvent[] page; int idxPage, idxEvent; byte[] bytes; char[] chars; XmlRawWriter?rawWriter; // Special-case single text node at the top-level if (_singleText.Count != 0) { writer.WriteString(_singleText.GetResult()); return; } rawWriter = writer as XmlRawWriter; // Loop over set of pages for (idxPage = 0; idxPage < _pages !.Count; idxPage++) { page = _pages[idxPage]; // Loop over events in each page for (idxEvent = 0; idxEvent < page.Length; idxEvent++) { switch (page[idxEvent].EventType) { case XmlEventType.Unknown: // No more events Debug.Assert(idxPage + 1 == _pages.Count); return; case XmlEventType.DocType: writer.WriteDocType(page[idxEvent].String1 !, page[idxEvent].String2, page[idxEvent].String3, (string?)page[idxEvent].Object); break; case XmlEventType.StartElem: writer.WriteStartElement(page[idxEvent].String1, page[idxEvent].String2 !, page[idxEvent].String3); break; case XmlEventType.StartAttr: writer.WriteStartAttribute(page[idxEvent].String1, page[idxEvent].String2 !, page[idxEvent].String3); break; case XmlEventType.EndAttr: writer.WriteEndAttribute(); break; case XmlEventType.CData: writer.WriteCData(page[idxEvent].String1); break; case XmlEventType.Comment: writer.WriteComment(page[idxEvent].String1); break; case XmlEventType.PI: writer.WriteProcessingInstruction(page[idxEvent].String1 !, page[idxEvent].String2); break; case XmlEventType.Whitespace: writer.WriteWhitespace(page[idxEvent].String1); break; case XmlEventType.String: writer.WriteString(page[idxEvent].String1); break; case XmlEventType.Raw: writer.WriteRaw(page[idxEvent].String1 !); break; case XmlEventType.EntRef: writer.WriteEntityRef(page[idxEvent].String1 !); break; case XmlEventType.CharEnt: writer.WriteCharEntity((char)page[idxEvent].Object !); break; case XmlEventType.SurrCharEnt: chars = (char[])page[idxEvent].Object !; writer.WriteSurrogateCharEntity(chars[0], chars[1]); break; case XmlEventType.Base64: bytes = (byte[])page[idxEvent].Object !; writer.WriteBase64(bytes, 0, bytes.Length); break; case XmlEventType.BinHex: bytes = (byte[])page[idxEvent].Object !; writer.WriteBinHex(bytes, 0, bytes.Length); break; case XmlEventType.XmlDecl1: if (rawWriter != null) { rawWriter.WriteXmlDeclaration((XmlStandalone)page[idxEvent].Object !); } break; case XmlEventType.XmlDecl2: if (rawWriter != null) { rawWriter.WriteXmlDeclaration(page[idxEvent].String1 !); } break; case XmlEventType.StartContent: if (rawWriter != null) { rawWriter.StartElementContent(); } break; case XmlEventType.EndElem: if (rawWriter != null) { rawWriter.WriteEndElement(page[idxEvent].String1 !, page[idxEvent].String2 !, page[idxEvent].String3 !); } else { writer.WriteEndElement(); } break; case XmlEventType.FullEndElem: if (rawWriter != null) { rawWriter.WriteFullEndElement(page[idxEvent].String1 !, page[idxEvent].String2 !, page[idxEvent].String3 !); } else { writer.WriteFullEndElement(); } break; case XmlEventType.Nmsp: if (rawWriter != null) { rawWriter.WriteNamespaceDeclaration(page[idxEvent].String1 !, page[idxEvent].String2 !); } else { writer.WriteAttributeString("xmlns", page[idxEvent].String1 !, XmlReservedNs.NsXmlNs, page[idxEvent].String2); } break; case XmlEventType.EndBase64: if (rawWriter != null) { rawWriter.WriteEndBase64(); } break; case XmlEventType.Close: writer.Close(); break; case XmlEventType.Flush: writer.Flush(); break; case XmlEventType.Dispose: ((IDisposable)writer).Dispose(); break; default: Debug.Fail("Unknown event: " + page[idxEvent].EventType); break; } } } Debug.Fail("Unknown event should be added to end of event sequence."); }
public override void WriteEndAttribute() { _writer.WriteEndAttribute(); }