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.Serializ ableAttribute()]
[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="urn:pro file")]
public class IqProfileType {
[System.Xml.Seri alization.XmlEl ementAttribute( "Name")]
public string Name;
[System.Xml.Seri alization.XmlAt tributeAttribut e(
Form=System.Xml .Schema.XmlSche maForm.Qualifie d,
Namespace="urn: common")]
public string ChangeNumber;
}
My xml (stripped down):
<m:IqProfile ChangeNumber="8 7" xmlns:m="urn:pr ofile"
xmlns:iq="urn:c ommon">
<m:Name>xyz</m:Name>
</m:IqProfile>
My xsd (stripped down):
<xsd:schema
targetNamespace ="urn:profil e"
xmlns="urn:prof ile"
xmlns:iq="urn:c ommon"
elementFormDefa ult="qualified"
version="1.0">
<xsd:complexTyp e
name="IqProfile Type"
<xsd:sequence >
<xsd:element
name="Name"
type="xsd:strin g" />
</xsd:sequence>
<xsd:attributeG roup ref="iq:Documen tRootAttributeG roup" />
</xsd:complexType >
</xsd:schema>
The "DocumentRootAt tributeGroup" is defined in another xsd (stripped
down version shown below) and is xsd:import'ed in the above xsd:
<xsd:schema
xmlns="urn:comm on"
targetNamespace ="urn:common "
elementFormDefa ult="qualified"
version="1.0">
<xsd:attributeG roup name="DocumentR ootAttributeGro up">
<xsd:attribut e name="ChangeNum ber" type="xsd:strin g"
use="required" />
</xsd:attributeGr oup>
</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.Seri alization.XmlAt tributeAttribut e()]
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