kolo / xmlrpc

Implementation of XMLRPC protocol in Go language.
MIT License
159 stars 94 forks source link

Allow for nil tags #75

Open sfowl opened 4 years ago

sfowl commented 4 years ago

I added this patch in order to work with an API that presents xml with any empty nil tag (i.e. <nil/>) when the value of foo is nil, e.g.:

     <struct>
        <member>
          <name>foo</name>
          <value>
            <nil/>
          </value>
        </member>
     ...
    </struct>

To use this patch, the struct looks like below:

type Params struct {
    Foo  *string `xmlrpc:"foo,nilTag"`
    Bar string  `xmlrpc:"bar"`
}

Would a patch like this be appropriate for kolo/xmlrpc? Any suggestions on better ways to work with this sort of data would be much appreciated (mostly I just want to avoid maintaining a separate fork) :)