简体   繁体   中英

Using SVCUTIL.EXE to generate DataContracts for NOAA Forcast

I'm writing an API for NOAA forecast data, and I'm trying to get the information from a XML document like this into a de-serialized object. I Downloaded the schema and it's two dependacies ( meta_data.xsd & ndfd_data.xsd ) and tried running this command

svcutil C:\DWML.xsd /dconly

But it returns with

Error: Cannot read D:\DWML.xsd.
Cannot load file D:\DWML.xsd as an Assembly. Check the FusionLogs for more information.

Can someone please walk me through the steps to create data contract for this xml document?

If there is an easier way to get this information into a easily querable form that doesn't require Data Contracts I'm willing to change my approach.

You need to supply all the xsd files to SvcUtil like so

svcutil *.xsd /dconly 

However trying this with NOAA schema gives bunch of errors and it suggested to use /importXmlTypes . But the following did not work for me either:

svcutil *.xsd /dconly /ser:XmlSerializer /importXmlTypes

Finally, used Xsd2Code

xsd2Code.exe DWML.xsd

and it worked like a charm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM