fsprojects / FSharp.Data

F# Data: Library for Data Access
https://fsprojects.github.io/FSharp.Data
Other
816 stars 287 forks source link

Support XSD in XmlProvider #57

Closed ovatsus closed 3 years ago

runefs commented 9 years ago

So I got the code working with compiled schema sets and also with what I find to be much cleaner code. However I have an issue in the travis build that I would very much appreciate a little insight into. Being pre-newb on travis and having very little experience with anything ending in .sh. The error on travis is very much consistent with an error that I previously had in the code which is now fixed and works locally and on AppV. So either travis is using an older version (from the previous pull request) which does semm that likely or I would like suggestion to why the build on travis could result in a stack overflow when that's not the case locally or on AppV. ANy information/suggestions would be highly appreciated

2015-08-11 15:56 GMT+02:00 Gustavo Guerra notifications@github.com:

no problem

— Reply to this email directly or view it on GitHub https://github.com/fsharp/FSharp.Data/issues/57#issuecomment-129884592.

giacomociti commented 9 years ago

Glad to see @runefs progress, so I better quit experimenting on my own. I may help a bit in refining and testing the code once it get merged. Unfortunately I cannot really help with trevis and build related stuff in general.

runefs commented 9 years ago

@GiacomoCiti I don't think it as such is caused by the build. It seems to be either Mono or *nix that causes it to work differently. I'm trying to create a VM where I can recreate the problem so that I can debug it

2015-08-27 22:02 GMT+02:00 Giacomo Citi notifications@github.com:

Glad to see @runefs https://github.com/runefs progress, so I better quit experimenting on my own. I may help a bit in refining and testing the code once it get merged. Unfortunately I cannot really help with trevis and build related stuff in general.

— Reply to this email directly or view it on GitHub https://github.com/fsharp/FSharp.Data/issues/57#issuecomment-135537286.

ckpearson commented 9 years ago

Hi, I'm working on a project at the moment that requires us to produce an XML document based on quite a strict and large schema and I instantly thought "F# type providers!". Did you manage to get this working at all?

runefs commented 9 years ago

Currently there's a cross compilation bug. System.Xml behaves differently in the mono binding and MS binding.

2015-09-08 17:50 GMT+02:00 Clint Pearson notifications@github.com:

Hi, I'm working on a project at the moment that requires us to produce an XML document based on quite a strict and large schema and I instantly thought "F# type providers!". Did you manage to get this working at all?

— Reply to this email directly or view it on GitHub https://github.com/fsharp/FSharp.Data/issues/57#issuecomment-138606184.

ckpearson commented 9 years ago

I see, is there a place I can grab it for targeting MS .NET? I'll only be running on Windows anyway.

CumpsD commented 8 years ago

@ckpearson this seems to be the place to grab it: https://github.com/fsharp/FSharp.Data/tree/XsdProvider

I'm looking forward to this too, now I'm trying to come up with XML examples to feed the TP to cover all properties I need to write out other XML, would be nicer to define it in xsd

giacomociti commented 8 years ago

@CumpsD you may check out my advice to create samples automatically. Looking forward to the XsdProvider we haven't heard from @runefs for a while. I hope there is some workaround to make it work on mono.

CumpsD commented 8 years ago

@giacomociti thanks for the advice!

runefs commented 8 years ago

I've spent some time on the XsdProvider again however after fetching the latest from the master I have some unexplained problems compiling the JsonProvider test cases, which is where I'm stuck for now. Due to this I haven't gotten to a state where I've completed all unit test. However some of the bugs from previous versions are now fixed. So I'll see if I can figure out why the compiler complains that it can't load the appropriate type for the JsonProvider

2015-12-03 9:47 GMT+01:00 Giacomo Citi notifications@github.com:

@CumpsD https://github.com/CumpsD you may check out my advice https://github.com/fsharp/FSharp.Data/issues/890#issuecomment-159741792 to create samples automatically. Looking forward to the XsdProvider we haven't heard from @runefs https://github.com/runefs for a while. I hope there is some workaround to make it work on mono.

— Reply to this email directly or view it on GitHub https://github.com/fsharp/FSharp.Data/issues/57#issuecomment-161554206.

runefs commented 8 years ago

I'm currently stuck with this error message

"....FSharp.Data.Tests/JsonProvider.fs(22,22): Error FS1109: A reference to the type 'FSharp.Data.JsonProvider,Sample=" [ {\"a\":12.3}, {\"a\":1.23, \"b\":1999.0} ] ",SampleIsList="True"' in assembly 'FSharp.Data' was found, but the type could not be found in that assembly (FS1109) (FSharp.Data.Tests)"

Since I haven't changed anything (willingly at least) with regards to the JsonProvider I'm at a loss. Any ideas to what could cause this would be very welcome :)

2015-12-09 19:42 GMT+01:00 rune funch søltoft rune@funch.dk:

I've spent some time on the XsdProvider again however after fetching the latest from the master I have some unexplained problems compiling the JsonProvider test cases, which is where I'm stuck for now. Due to this I haven't gotten to a state where I've completed all unit test. However some of the bugs from previous versions are now fixed. So I'll see if I can figure out why the compiler complains that it can't load the appropriate type for the JsonProvider

2015-12-03 9:47 GMT+01:00 Giacomo Citi notifications@github.com:

@CumpsD https://github.com/CumpsD you may check out my advice https://github.com/fsharp/FSharp.Data/issues/890#issuecomment-159741792 to create samples automatically. Looking forward to the XsdProvider we haven't heard from @runefs https://github.com/runefs for a while. I hope there is some workaround to make it work on mono.

— Reply to this email directly or view it on GitHub https://github.com/fsharp/FSharp.Data/issues/57#issuecomment-161554206.

Kazark commented 8 years ago

:+1:

giacomociti commented 8 years ago

I've been playing again with my implementation and released it as a separate project.

I just referenced most source code of FSharp.Data, added one file (XsdInference.fs) and slightly modified XmlProvider.fs adding a Schema parameter.

Of course I just could have made a PR to FSharp.Data. But, first, we already have an ongoing attempt. And I'm also afraid that my stuff may have more or less the same issues when it comes to integration and making things work across multiple platforms and versions.

So I'm glad if someone is willing to experiment with FSharp.Data.Xsd but be warned about this kind of issues and its overall maturity.

TonyHenrique commented 6 years ago

I have a complex XSD Schema (multiple files). How can I use F# to read it so I can use this to generate an output XML, with my data on that XSD structure?

nfe_v4.00.xsd and xmldsig-core-schema_v1.01.xsd

http://www.nfe.fazenda.gov.br/portal/exibirArquivo.aspx?conteudo=BALgvpK9Jvo=

In C# I could do

xsd.exe nfe_v4.00.xsd xmldsig-core-schema_v1.01.xsd /c /edb

How can I do this in F# (Code Generated F# Types), or, can I read these two XSD directly on F# (F# Type Provider)

giacomociti commented 6 years ago

hi @TonyHenrique, xsd is not supported yet in F# Data. The XsdProvider branch is not merged, nor is my PR #1004 If you are willing to use FSharp.Data.Xsd instead, I think your use case is easily supported with the ResolutionFolder parameter, as explained here

ovatsus commented 6 years ago

I'll have a look at trying to merge that this month. Should I consider that PR as a replacement for the old branch?

giacomociti commented 6 years ago

Yes, the PR is an alternative to the existing branch

TonyHenrique commented 6 years ago

@giacomociti After adding ResolutionFolder, it can read the XML using the 2 XSD definitions. Now, how can I populate the F# type with Data and generate a XML? is that supported? Can you post a link describing how to do this?

giacomociti commented 6 years ago

@TonyHenrique type providers are more geared towards reading, but writing is supported simply using the constructors on the types generated by the XmlProvider, as explained in the Transforming XML section towards the end of the XmlProvider documentation

brettrowberry commented 6 years ago

Has this been resolved?

toburger commented 6 years ago

I'm already using the separate FSharp.Data.Xsd Type Provider, but it would be awesome if the excellent work of @giacomociti could be merged into FSharp.Data.

ovatsus commented 6 years ago

I also really want this, it's on the queue for review after the .net standard PR is finished

On 22 Mar 2018 10:37, Tobias Burger notifications@github.com wrote:

I'm already using the separate FSharp.Data.Xsd Type Provider, but it would be awesome if the awesome work of @giacomocitihttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgiacomociti&data=02%7C01%7C%7C3b556186d0fb4e04094708d58fe0f202%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636573118689298244&sdata=U7C85i8Ox877AlNCITvLIr5sjw13vm2f5ZtI2vDcOKc%3D&reserved=0 could be merged into FSharp.Data.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffsharp%2FFSharp.Data%2Fissues%2F57%23issuecomment-375257758&data=02%7C01%7C%7C3b556186d0fb4e04094708d58fe0f202%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636573118689298244&sdata=1OyxVkusO7jhe4Tq7qqAVrd2SRxzrWtundYEQ1K984c%3D&reserved=0, or mute the threadhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAtFyQMWi_MDbuJ5SMx8-oWLjLh0uwC3ks5tg370gaJpZM4AZo08&data=02%7C01%7C%7C3b556186d0fb4e04094708d58fe0f202%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636573118689298244&sdata=oPByqJ4o4A8N5jntMkrnxCqiUuSNKq5hZb3CRNbCCzo%3D&reserved=0.