Hi All,
I have XML:
<RegistryResponse status="Success" xmlns="urn:oasis:names:tc:ebxml-regrep:registry:xsd:2.1">
<AdhocQueryResponse xmlns="urn:oasis:names:tc:ebxml-regrep:query:xsd:2.1">
<SQLQueryResult>
<ObjectRef id="urn:uuid:425cb4ea-752c-4276-ae52-db295e8e7dc4" />
<ObjectRef id="urn:uuid:d9769b84-c48e-4381-bfd2-fe6e5c67cfc7" />
</SQLQueryResult>
</AdhocQueryResponse>
</RegistryResponse>
And I have the class generated by XSD tools:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType = true, Namespace = "urn:oasis:names:tc:ebxml-regrep:query:xsd:2.1")]
[System.Xml.Serialization.XmlRootAttribute(Namespac e = "urn:oasis:names:tc:ebxml-regrep:query:xsd:2.1", IsNullable = false)]
public partial class AdhocQueryResponse
{
private object itemField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Filt erQueryResult", typeof(FilterQueryResult))]
[System.Xml.Serialization.XmlElementAttribute("SQLQ ueryResult", typeof(RegistryObjectListType))]
public object Item
{
get
{
return this.itemField;
}
set
{
this.itemField = value;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e = "urn:oasis:names:tc:ebxml-regrep:rim:xsd:2.1")]
[System.Xml.Serialization.XmlRootAttribute("SQLQuer yResult", Namespace = "urn:oasis:names:tc:ebxml-regrep:query:xsd:2.1", IsNullable = false)]
public partial class RegistryObjectListType : LeafRegistryObjectListType
{
private object[] items1Field;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Obje ctRef", typeof(ObjectRefType))]
[System.Xml.Serialization.XmlElementAttribute("Regi stryEntry", typeof(RegistryEntryType))]
[System.Xml.Serialization.XmlElementAttribute("Regi stryObject", typeof(RegistryObjectType))]
public object[] Items1
{
get
{
return this.items1Field;
}
set
{
this.items1Field = value;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e = "urn:oasis:names:tc:ebxml-regrep:rim:xsd:2.1")]
[System.Xml.Serialization.XmlRootAttribute("ObjectR ef", Namespace = "urn:oasis:names:tc:ebxml-regrep:rim:xsd:2.1", IsNullable = false)]
public partial class ObjectRefType
{
private string idField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute(Dat aType = "ID")]
public string id
{
get
{
return this.idField;
}
set
{
this.idField = value;
}
}
}
I just post the related code, the full complete xsd are available at :
http://www.oasis-open.org/committees/regrep/documents/2.1/schema/rs.xsd
http://www.oasis-open.org/committees/regrep/documents/2.1/schema/query.xsd
http://www.oasis-open.org/committees/regrep/documents/2.1/schema/rim.xsd
I tried to deserialize the xml into object, the code is:
XmlNodeReader reader = new XmlNodeReader(doc.FirstChild.FirstChild);
XmlSerializer ser = new XmlSerializer(typeof(AdhocQueryResponse));
AdhocQueryResponse AQR;
AQR = (AdhocQueryResponse)ser.Deserialize(reader);
RegistryObjectListType ROLT = (RegistryObjectListType)AQR.Item;
There is no exception occoured, but my Item is all null...
I have no idea how to fix and trace the error.
Please help me.