Here is my attempt, xsd and classes created from xsd.exe
Running my code I get error "There is an error in XML document (1, 2)." Inner exception {" was not expected."}
Any help would be greatly appreciated.
Thanks!
XML Snippet:
<xml>
<creditBureau xmlns="http://www.transunion.com/namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<document>response</document>
<version>2.2</version>
<transactionControl>
<userRefNumber>260907</userRefNumber>
<subscriber>
<industryCode>P</industryCode>
<memberCode>04784547</memberCode>
<inquirySubscriberPrefixCode>1527</inquirySubscriberPrefixCode>
</subscriber>...
XSD Snippet:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://www.transunion.com/namespace"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://www.transunion.com/namespace"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="creditBureau">
<xs:complexType>
<xs:sequence>
<xs:element name="document" type="xs:string" />
<xs:element name="version" type="xs:decimal" />
<xs:element name="transactionControl">
<xs:complexType>
<xs:sequence>
<xs:element name="userRefNumber" type="xs:unsignedInt" />
<xs:element name="subscriber">...
Class Snippet:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.transunion.com/namespace")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.transunion.com/namespace", IsNullable=false)]
public partial class creditBureau {
private string documentField;
private decimal versionField;
private creditBureauTransactionControl transactionControlField;
private creditBureauProduct productField;
public string document {
get {
return this.documentField;
}
set {
this.documentField = value;
}
}
public decimal version {
get {
return this.versionField;
}
set {
this.versionField = value;
}
}
public creditBureauTransactionControl transactionControl {
get {
return this.transactionControlField;
}
set {
this.transactionControlField = value;
}
}
public creditBureauProduct product {
get {
return this.productField;
}
set {
this.productField = value;
}
}
}
Code Snippet:
FileStream fs = new FileStream("XMLFile1.xml", FileMode.Open);
XmlSerializer x = new XmlSerializer(typeof(creditBureau));
creditBureau c = (creditBureau)x.Deserialize(fs);