views:

241

answers:

2

I've been working to create classes representing the HR-Xml 3 spec for the stand-along packages related to Screening. I've had a couple of problems, but currently I believe the main problem is the lack of support within xsd.exe for the xsd:union statement.

When Xsd.exe encounters a simple type defined by union, it ignores the definition and uses the built-in string data type in its place.
From - http://msdn.microsoft.com/en-us/library/bc57azyw%28VS.85%29.aspx

The only solution I've seen on various forums and newsgroups is to restructure the XSD to not use the union? However, even with the small subset of entities I need, the number of union statements approaches 100. Perhaps this is the only solution?

I've been stuck on this for a number of days now and haven't been able to find anything real useful, besides "nope, that doesn't work". In the end, I need to make it work somehow. Any suggestions for tools, redesigns, converters, anything that can get me these classes! I've even started to think about generating Java classes and then converting those to C#... I'm at a loss

Thanks in advance! I certainly hope there's some solution to this!

A: 

Two things you could try fairly easily and quicky to see if they provide any help:

  • use the WCF svcutil.exe utility (with the /dconly switch) instead of xsd.exe - this will attempt to create a class based on the WCF DataContractSerializer which can handle a few things better than the standard .NET XML Serializer

  • try an alternate "XSD-to-code" generator, for instance something like Xsd2Code on Codeplex

Marc

marc_s
Thanks for the answer, unfortunately I've tried both of these with no success >< svcutil outputs some text about required attributes, while Xsd2Code doesn't seem to respect includes and I do not have an xsd containing the entire schema. Here's the relevant output from svcutil:Error: Type 'BusinessObjectDocumentType' in namespace 'http://www.openapplications.org/oagis/9' cannot be imported. Attributes must be optional and from namespace 'http://schemas.microsoft.com/2003/10/Serialization/'.
mklinker
A: 

In the end, we made the decision that we wouldn't implement HR-Xml in the first phase, perhaps when we get back to it, I'll have better luck. Still, if anyone reads this and has any suggestions please leave feedback as I plan to monitor this for a while.

mklinker