zek icon indicating copy to clipboard operation
zek copied to clipboard

Type inferencing

Open mattwilliamson opened this issue 5 years ago • 4 comments

This would be really nice. If you point me in the right direction, I might be willing to implement.

mattwilliamson avatar Aug 30 '19 20:08 mattwilliamson

Quick reply: Thanks for the suggestion, if I had not been too lazy, I would have implemented it already :) The other aspect is that zek allows to operate on XML without schema, which is both nice and fuzzy. Not inferring the type is expressing that fuzziness.

That said, it would be nice - as an optional flag.

miku avatar Aug 31 '19 11:08 miku

Hello guys, any news about this feature? As @mattwilliamson I would be happy to help you implementing it, if you can please point me in the right direction as well. That's my scenario: I am using pyang to convert a yang model to an empty xml data and using a specific flag it will save the type (since it has access to the model/schema) inside the xml as a comment, something like this:

<alarm-state>
    <!-- type: boolean -->
</alarm-state>

So for me it would be just a matter of getting access to that comment. Do you have any clue on where I should start from?

marcodellemarche avatar Apr 14 '21 09:04 marcodellemarche

@marcodellemarche, thanks for the use case. Not exactly an answer, but I recently saw xsd2go - if you have a schema, this might be a way to go.

miku avatar Apr 20 '21 08:04 miku

I recently saw: https://github.com/twpayne/go-xmlstruct - which implements type inference nicely.

miku avatar Feb 21 '23 10:02 miku