public virtual void WriteNode(XmlDictionaryReader reader, bool defattr) { ArgumentNullException.ThrowIfNull(reader); int d = (reader.NodeType == XmlNodeType.None ? -1 : reader.Depth); do { XmlNodeType nodeType = reader.NodeType; Type? type; if (nodeType == XmlNodeType.Text || nodeType == XmlNodeType.Whitespace || nodeType == XmlNodeType.SignificantWhitespace) { // This will advance if necessary, so we don't need to call Read() explicitly WriteTextNode(reader, false); } else if (reader.Depth > d && reader.IsStartArray(out type)) { WriteArrayNode(reader, type); } else { // These will not advance, so we must call Read() explicitly switch (nodeType) { case XmlNodeType.Element: WriteElementNode(reader, defattr); break; case XmlNodeType.CDATA: WriteCData(reader.Value); break; case XmlNodeType.EntityReference: WriteEntityRef(reader.Name); break; case XmlNodeType.XmlDeclaration: case XmlNodeType.ProcessingInstruction: WriteProcessingInstruction(reader.Name, reader.Value); break; case XmlNodeType.DocumentType: WriteDocType(reader.Name, reader.GetAttribute("PUBLIC"), reader.GetAttribute("SYSTEM"), reader.Value); break; case XmlNodeType.Comment: WriteComment(reader.Value); break; case XmlNodeType.EndElement: WriteFullEndElement(); break; } if (!reader.Read()) { break; } } }while (d < reader.Depth || (d == reader.Depth && reader.NodeType == XmlNodeType.EndElement)); }
public virtual void WriteNode(XmlDictionaryReader reader, bool defattr) { XmlNodeType type; if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader")); } int num = (reader.NodeType == XmlNodeType.None) ? -1 : reader.Depth; Label_002A: type = reader.NodeType; switch (type) { case XmlNodeType.Text: case XmlNodeType.Whitespace: case XmlNodeType.SignificantWhitespace: this.WriteTextNode(reader, false); goto Label_0136; default: Type type2; if ((reader.Depth > num) && reader.IsStartArray(out type2)) { this.WriteArrayNode(reader, type2); goto Label_0136; } switch (type) { case XmlNodeType.Element: this.WriteElementNode(reader, defattr); goto Label_012D; case XmlNodeType.CDATA: this.WriteCData(reader.Value); goto Label_012D; case XmlNodeType.EntityReference: this.WriteEntityRef(reader.Name); goto Label_012D; case XmlNodeType.ProcessingInstruction: case XmlNodeType.XmlDeclaration: this.WriteProcessingInstruction(reader.Name, reader.Value); goto Label_012D; case XmlNodeType.Comment: this.WriteComment(reader.Value); goto Label_012D; case XmlNodeType.DocumentType: this.WriteDocType(reader.Name, reader.GetAttribute("PUBLIC"), reader.GetAttribute("SYSTEM"), reader.Value); goto Label_012D; case XmlNodeType.EndElement: this.WriteFullEndElement(); goto Label_012D; } break; } Label_012D: if (!reader.Read()) { return; } Label_0136: if ((num < reader.Depth) || ((num == reader.Depth) && (reader.NodeType == XmlNodeType.EndElement))) { goto Label_002A; } }
public virtual void WriteNode(XmlDictionaryReader reader, bool defattr) { if (reader == null) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader")); int d = (reader.NodeType == XmlNodeType.None ? -1 : reader.Depth); do { XmlNodeType nodeType = reader.NodeType; Type type; if (nodeType == XmlNodeType.Text || nodeType == XmlNodeType.Whitespace || nodeType == XmlNodeType.SignificantWhitespace) { // This will advance if necessary, so we don't need to call Read() explicitly WriteTextNode(reader, false); } else if (reader.Depth > d && reader.IsStartArray(out type)) { WriteArrayNode(reader, type); } else { // These will not advance, so we must call Read() explicitly switch (nodeType) { case XmlNodeType.Element: WriteElementNode(reader, defattr); break; case XmlNodeType.CDATA: WriteCData(reader.Value); break; case XmlNodeType.EntityReference: WriteEntityRef(reader.Name); break; case XmlNodeType.XmlDeclaration: case XmlNodeType.ProcessingInstruction: WriteProcessingInstruction(reader.Name, reader.Value); break; case XmlNodeType.DocumentType: WriteDocType(reader.Name, reader.GetAttribute("PUBLIC"), reader.GetAttribute("SYSTEM"), reader.Value); break; case XmlNodeType.Comment: WriteComment(reader.Value); break; case XmlNodeType.EndElement: WriteFullEndElement(); break; } if (!reader.Read()) break; } } while (d < reader.Depth || (d == reader.Depth && reader.NodeType == XmlNodeType.EndElement)); }