Hi,
I'm having an issue with deserializing some xml using a proxy class
generated by "xsd.exe". My proxy class contains this class definition:
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="urn:profile")]
public class IqProfileType {
[System.Xml.Serialization.XmlElementAttribute("Name ")]
public string Name;
[System.Xml.Serialization.XmlAttributeAttribute(
Form=System.Xml.Schema.XmlSchemaForm.Qualified,
Namespace="urn:common")]
public string ChangeNumber;
}
My xml (stripped down):
<m:IqProfile ChangeNumber="87" xmlns:m="urn:profile"
xmlns:iq="urn:common">
<m:Name>xyz</m:Name>
</m:IqProfile>
My xsd (stripped down):
<xsd:schema
targetNamespace="urn:profile"
xmlns="urn:profile"
xmlns:iq="urn:common"
elementFormDefault="qualified"
version="1.0">
<xsd:complexType
name="IqProfileType"
<xsd:sequence>
<xsd:element
name="Name"
type="xsd:string" />
</xsd:sequence>
<xsd:attributeGroup ref="iq:DocumentRootAttributeGroup" />
</xsd:complexType>
</xsd:schema>
The "DocumentRootAttributeGroup" is defined in another xsd (stripped
down version shown below) and is xsd:import'ed in the above xsd:
<xsd:schema
xmlns="urn:common"
targetNamespace="urn:common"
elementFormDefault="qualified"
version="1.0">
<xsd:attributeGroup name="DocumentRootAttributeGroup">
<xsd:attribute name="ChangeNumber" type="xsd:string"
use="required" />
</xsd:attributeGroup>
</xsd:schema>
My deserializer isn't able to map the attribute properly .. what do I
miss to make this work? If I change the proxy class to read:
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ChangeNumber;
i.e. if I remove the "Form" and "Namespace" properties it works as
expected.
I've tried to simply the above xml and xsd so please let me know if you
need more information. Do I need a prefix somewhere?
I'm using .NET 2.0 beta but I don't think that matters in this case.
Rgd,
Peter Theill