• Kyle Lemons's avatar
    xml: add Marshal and MarshalIndent · abd50de2
    Kyle Lemons authored
    I have written up a Marshal and MarshalIndent pair that should
    closely reflect the way that Unmarshal works.  I would love feedback
    on making this code more accessible and efficient... I haven't used
    reflecton on this scale before, so there is probably a lot of work
    that can be done on that.
    
    Some potentially controversial things:
    - All tag names are lower-cased by default.
    - Zero-valued struct values are skipped.
    - No namespace prefix (o:tag, etc) mechanism is supplied.
    - You are allowed to marshal non-struct values (even though unmarshal
      cannot handle them).
    - A tag for a non-XMLName struct field that isn't "attr", "chardata",
      or "innerxml" is used as the name of the tag.  This could wreak
      havoc if you try to marshal a protobuf struct.
    - The "innerxml" and "chardata" are inserted verbatim.  If you try to
      marshal something straight from unmarshal, the results could be
      unexpected (remove "innerxml" support from Marshal would be one
      possible solution).
    
    R=rsc
    CC=golang-dev
    https://golang.org/cl/4539082
    abd50de2
Name
Last commit
Last update
..
Makefile Loading commit data...
atom_test.go Loading commit data...
embed_test.go Loading commit data...
marshal.go Loading commit data...
marshal_test.go Loading commit data...
read.go Loading commit data...
read_test.go Loading commit data...
xml.go Loading commit data...
xml_test.go Loading commit data...