Forums: Troubleshooting and Problems
I edited the define-extension.xsd and validator-extension.xsd files to comment out the MetaDataVersionPreIncludeElementExtension element in the MetaDataVersionPreIncludeElementExtension sequence.
<code>
<xs:group name="MetaDataVersionPreIncludeElementExtension">
<xs:sequence>
<!-- Commented out to allow generation with XSD.exe - causes circular reference error -->
<!--<xs:group ref="MetaDataVersionPreIncludeElementExtension"/>-->
<xs:element ref="def:AnnotatedCRF" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="def:SupplementalDoc" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="def:leaf" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="def:ComputationMethod" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="def:ValueListDef" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:group>
<code>
And it no longer said it was a circular reference for MetaDataVersionPreIncludeElementExtension . But it did give more circular references:
So I modified the XSDs the same way and it generated the C# file for me. But there are still some schema validation warnings it presents that I don't understand. They are a result of me commenting out the elements in the sequence.
<code>
Schema validation warning: Invalid particle derivation by restriction. Line 29, position 5.
Schema validation warning: Invalid particle derivation by restriction. Line 95, position 5.
Schema validation warning: Invalid particle derivation by restriction. Line 53, position 5.
Schema validation warning: Invalid particle derivation by restriction. Line 77, position 6.
</code>
Any ideas on how to fix them?
Thanks,
Matt
Dear Matt:
No, I haven't tried that either. However, you may find this useful, especially what it says re: MSXML.
http://www.cdisc.org/stuff/contentmgr/files/0/464923b10ea16b477151fcaa9f465166/misc/definereport_v1_0.pdf
I think that references the validation of XML files based on the XSD, not validation of the XSD itself.
I found this indicating that XSD.exe doesn't support redefine tags:
http://msdn.microsoft.com/en-us/library/xsayb845%28v=vs.90%29.aspx
(Found from this page: http://social.msdn.microsoft.com/Forums/sr-sp-latn/wcf/thread/ce989d78-357d-47c3-b801-9d4de6d21d15)
Any ideas on how to modify the XSD files to get around this?
I think I figured it out. I did some commenting out and it generates w/o any errors or warnings.
I basically commented out:
Hi,
Since the project uses Java, I'm assuming no one has done this, but I'd thought I check anyhow.
I was trying to generate C# classes based on the validator1-0-0.xsd schema (http://svn.opencdisc.org/validator/trunk/resources/schema) in order to read the config files for SEND. I was hoping to be able to use the OpenCDISC SEND configuration files since they pretty much layout the entire SEND format in a way that I can work with programmatically.
I copied all the xsd files from the SVN resources folder as well as the ODM v1.2.1 schema files into a folder:
I then tried using the Microsoft Visual Studio XSD tool to generate the C# classes with the following command line:
<path to xsd.exe> /c /l:CS /n:OpenCDISC.Validator validator1-0-0.xsd
The path to xsd.exe for me is: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\xsd.exe
Unfortunately the XSD tool had problems resolving references over the web, so I needed to modify the files to point to the local XSD instead of the URL. To do this I removed everything but the XSD filename from the XSD files in the schemaLocation attribute of the <xs:import> and <xs:redefine> elements.
I also had to add the xmldsig-core-schema.xsd and define-ns.xsd to my command line (as it appeared to still had issues resolving nested includes):
<path to xsd.exe> /c /l:CS /n:OpenCDISC.Validator xmldsig-core-schema.xsd define-ns.xsd validator-ns.xsd validator1-0-0.xsd
With that change to the command line, these were the only issues:
Unfortunately due to the Error, it's unable to generate the C# code.
Does anyone have any suggestions or patches to resolve the circular group reference of ODM's MetaDataVersionPreIncludeElementExtension? I was able to generate ODM 1.2.1 C# classes using the XSD tool just fine, so I'm guessing the issue is in the validation XSDs. It's used in:
UPDATE (2012-08-02): I found this on Microsoft's bug reporting site. Apparently circular group references are not allowed according to the W3C's specs for Model Group Validation. So the XSD tool doesn't support them. So I guess the question is how can I modify the XSD(s) to be compliant and still usable?
http://connect.microsoft.com/VisualStudio/feedback/details/637855/xsd-exe-fails-to-handle-circular-group-references
Thanks,
Matt