using System.Collections.Generic;
using System.Xml.Serialization;
using System.Diagnostics;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Collections;
namespace Question42490161
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class OxFordDefinition {
private string sourceURLField;
private string originDescField;
private OxFordDefinition_perGroup[] _perGroupField;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string sourceURL {
return this.sourceURLField;
this.sourceURLField = value;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string originDesc {
return this.originDescField;
this.originDescField = value;
[System.Xml.Serialization.XmlElementAttribute("_perGroup", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public OxFordDefinition_perGroup[] _perGroup {
return this._perGroupField;
this._perGroupField = value;
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class OxFordDefinition_perGroup {
private string _GroupDescField;
private string _GroupSenseField;
private string _GroupGrammerField;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string _GroupDesc {
return this._GroupDescField;
this._GroupDescField = value;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string _GroupSense {
return this._GroupSenseField;
this._GroupSenseField = value;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string _GroupGrammer {
return this._GroupGrammerField;
this._GroupGrammerField = value;
private OxFordDefinition_perGroup_perMainExample_perSubExample[] _perMainExampleField;
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("_perSubExample", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public OxFordDefinition_perGroup_perMainExample_perSubExample[] _perMainExample {
return this._perMainExampleField;
this._perMainExampleField = value;
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class OxFordDefinition_perGroup_perMainExample_perSubExample {
private string _UpperTitleField;
private string _FormGroupField;
private string _SenseNotField;
private string _GrammaticNotField;
private string _DescField;
private string _SynonymsField;
private OxFordDefinition_perGroup_perMainExample_perSubExample_Example[] _ExampleField;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string _UpperTitle {
return this._UpperTitleField;
this._UpperTitleField = value;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string _FormGroup {
return this._FormGroupField;
this._FormGroupField = value;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string _SenseNot {
return this._SenseNotField;
this._SenseNotField = value;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string _GrammaticNot {
return this._GrammaticNotField;
this._GrammaticNotField = value;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string _Synonyms {
return this._SynonymsField;
this._SynonymsField = value;
[System.Xml.Serialization.XmlElementAttribute("_Example", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public OxFordDefinition_perGroup_perMainExample_perSubExample_Example[] _Example {
return this._ExampleField;
this._ExampleField = value;
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class OxFordDefinition_perGroup_perMainExample_perSubExample_Example {
private string _SenseNotField;
private string _GrammaticNotField;
private string _DescField;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string _SenseNot {
return this._SenseNotField;
this._SenseNotField = value;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string _GrammaticNot {
return this._GrammaticNotField;
this._GrammaticNotField = value;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class NewDataSet {
private OxFordDefinition[] itemsField;
[System.Xml.Serialization.XmlElementAttribute("OxFordDefinition")]
public OxFordDefinition[] Items {
internal static void Test()
using (var client = new WebClient())
xml = client.DownloadString("http://pastebin.com/raw/BJhRfFNf");
var root = xml.LoadFromXml<OxFordDefinition>();
var xml2 = root.GetXml();
Console.WriteLine("Deserialized and re-serialized XML: ");
public static void Main()
public static class XmlSerializationHelper
public static T LoadFromXml<T>(this string xmlString, XmlSerializer serial = null)
serial = serial ?? new XmlSerializer(typeof(T));
T returnValue = default(T);
using (StringReader reader = new StringReader(xmlString))
object result = serial.Deserialize(reader);
public static string GetXml<T>(this T obj, XmlSerializer serializer = null, bool omitStandardNamespaces = false)
XmlSerializerNamespaces ns = null;
if (omitStandardNamespaces)
ns = new XmlSerializerNamespaces();
using (var textWriter = new StringWriter())
var settings = new XmlWriterSettings() { Indent = true };
using (var xmlWriter = XmlWriter.Create(textWriter, settings))
(serializer ?? new XmlSerializer(obj.GetType())).Serialize(xmlWriter, obj, ns);
return textWriter.ToString();