aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/encoding/xml/read.go
AgeCommit message (Collapse)Author
2013-11-01[release-branch.go1.2] encoding/xml: fix doc commentAndrew Gerrand
««« CL 19300046 / 5ac568b9d67b encoding/xml: fix doc comment The tag is ",chardata" not "chardata". Fixes #6631. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/19300046 »»» R=golang-dev CC=golang-dev https://golang.org/cl/20060045
2013-08-14encoding/xml: support generic encoding interfacesRuss Cox
Remove custom support for time.Time. No new tests: the tests for the time.Time special case now test the general case. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12751045
2013-08-14encoding/xml: add, support Unmarshaler interfaceRuss Cox
See golang.org/s/go12xml for design. R=golang-dev, dominik.honnef, dan.kortschak CC=golang-dev https://golang.org/cl/12556043
2013-07-10encoding/xml: fix typo in docsAndrew Gerrand
Fixes #5843. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/11073043
2013-03-12encoding/xml: name space bug fixesRuss Cox
If two fields have the same name but different explicit name spaces, treat as non-conflicting. This allows parsing common XML formats that have ns1:tag and ns2:tag in the same XML element. Fixes #4691. Allow setting the default name space for unadorned tags, by writing to Decoder.DefaultSpace. This allows turned the job of parsing common XML formats that have tag and ns2:tag in the same XML element into the first case by setting DefaultSpace="ns1". Fixes #3703. Use name space attributes when decoding. Attach name space to attributes when encoding. Could be done with fewer annotations, but semantically correct as is. Fixes #3526. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/7227056
2013-03-11all: remove now-unnecessary unreachable panicsBrad Fitzpatrick
Take advantage of the new terminating statement rule. R=golang-dev, r, gri CC=golang-dev https://golang.org/cl/7712044
2013-01-22encoding/xml: simplify copyValueRuss Cox
Delete various complications left over from an earlier reflect API. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/7124063
2013-01-18encoding/xml: fix decoding of attributes in to pointer fields.Kamil Kisiel
Fixes #3719. R=anacrolix, rsc CC=golang-dev https://golang.org/cl/7131052
2012-12-22encoding/xml: Marshal ",any" fieldsChris Jones
Fixes #3559. This makes Marshal handle fields marked ",any" instead of ignoring them. That makes Marshal more symmetrical with Unmarshal, which seems to have been a design goal. Note some test cases were changed, because this patch changes marshalling behavior. I think the previous behavior was buggy, but there's still a backward-compatibility question to consider. R=rsc CC=golang-dev, n13m3y3r https://golang.org/cl/6938068
2012-05-16encoding/xml: handle anonymous pointer fieldsGustavo Niemeyer
This CL makes type T struct { *U } behave in a similar way to: type T struct { U } Fixes #3108. R=golang-dev, rsc, gustavo CC=golang-dev https://golang.org/cl/5694044
2012-02-23encoding/xml: add example and docs for anon fieldsGustavo Niemeyer
Anonymous pointer fields is not yet supported. The problem is documented in issue 3108. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5694043
2012-02-22encoding/xml: move Unmarshal example to functionGustavo Niemeyer
This also fixes MarshalIndent's example after the recent formatting convention changes. Fixes #2831. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5671062
2012-02-07time: clean up MarshalJSON, add RFC3339 methodRuss Cox
encoding/xml: handle time.Time as recognized type The long term plan is to define an interface that time.Time can implement and that encoding/xml can call, but we are not going to try to define that interface before Go 1. Instead, special-case time.Time in package xml, because it is such a fundamental type, as a stop-gap. The eventual methods will behave this way. Fixes #2793. R=golang-dev, r, r, n13m3y3r CC=golang-dev https://golang.org/cl/5634051
2012-02-07encoding/xml: fix documentation for Decoder.SkipRob Pike
Fixes #2850. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5645043
2012-01-30doc: use consistent receiver names, when it makes sense.Brad Fitzpatrick
Makes for prettier docs. R=golang-dev, dsymonds, r, rsc CC=golang-dev https://golang.org/cl/5576056
2012-01-30encoding/xml: fix decoding of xml.Name with sub-elementsGustavo Niemeyer
R=golang-dev, adg CC=golang-dev https://golang.org/cl/5569090
2012-01-24encoding/xml: add docs for ignoring tagGustavo Niemeyer
That was supposed to be in the original CL, but missed the files. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5570052
2012-01-24encoding/xml: bring API closer to other packagesGustavo Niemeyer
Includes gofix module. The only case not covered should be xml.Unmarshal, since it remains with a similar interface, and would require introspecting the type of its first argument better. Fixes #2626. R=golang-dev, rsc, gustavo CC=golang-dev https://golang.org/cl/5574053
2012-01-23encoding/xml: minor doc fixupGustavo Niemeyer
R=golang-dev, adg CC=golang-dev https://golang.org/cl/5564046
2012-01-23encoding/xml: improve []byte handlingGustavo Niemeyer
Marshalling of []byte in attributes and the general marshalling of named []byte types was fixed. A []byte field also won't be nil if an XML element was mapped to it, even if the element is empty. Tests were introduced to make sure that *struct{} fields works correctly for element presence testing. No changes to the logic made in that regard. R=rsc CC=golang-dev https://golang.org/cl/5539070
2012-01-19encoding/xml: marshal/unmarshal xml.Name in fieldGustavo Niemeyer
R=rsc CC=golang-dev https://golang.org/cl/5542052
2012-01-13xml: major Go 1 fixupGustavo Niemeyer
This CL improves the xml package in the following ways: - makes its interface match established conventions - brings Marshal and Unmarshal closer together - fixes a large number of bugs and adds tests - improves speed significantly - organizes and simplifies the code Fixes #2426. Fixes #2406. Fixes #1989. What follows is a detailed list of those changes. - All matching is case sensitive without special processing to the field name or xml tag in an attempt to match them. Customize the field tag as desired to match the correct XML elements. - Flags are ",flag" rather than "flag". The names "attr", "chardata", etc, may be used to name actual XML elements. - Overriding of attribute names is possible with "name,attr". - Attribute fields are marshalled properly if they have non-string types. Previously they were unmarshalled, but were ignored at marshalling time. - Comment fields tagged with ",comment" are marshalled properly, rather than being marshalled as normal fields. - The handling of the Any field has been replaced by the ",any" flag to avoid unexpected results when using the field name for other purposes, and has also been fixed to interact properly with name paths. Previously the feature would not function if any field in the type had a name path in its tag. - Embedded struct support fixed and cleaned so it works when marshalling and also when using field paths deeper than one level. - Conflict reporting on field names have been expanded to cover all fields. Previously it'd catch only conflicts of paths deeper than one level. Also interacts correctly with embedded structs now. - A trailing '>' is disallowed in xml tags. It used to be supported for removing the ambiguity between "attr" and "attr>", but the marshalling support for that was broken, and it's now unnecessary. Use "name" instead of "name>". - Fixed docs to point out that a XMLName doesn't have to be an xml.Name (e.g. a struct{} is a good fit too). The code was already working like that. - Fixed asymmetry in the precedence of XML element names between marshalling and unmarshalling. Marshal would consider the XMLName of the field type before the field tag, while unmarshalling would do the opposite. Now both respect the tag of the XMLName field first, and a nice error message is provided in case an attempt is made to name a field with its tag in a way that would conflict with the underlying type's XMLName field. - Do not marshal broken "<???>" tags when in doubt. Use the type name, and error out if that's not possible. - Do not break down unmarshalling if there's an interface{} field in a struct. - Significant speed boost due to caching of type metadata and overall allocation clean ups. The following timings reflect processing of the the atom test data: Old: BenchmarkMarshal 50000 48798 ns/op BenchmarkUnmarshal 5000 357174 ns/op New: BenchmarkMarshal 100000 19799 ns/op BenchmarkUnmarshal 10000 128525 ns/op R=cw, gustavo, kevlar, adg, rogpeppe, fullung, christoph, rsc CC=golang-dev https://golang.org/cl/5503078
2011-12-05use new strconv APIRuss Cox
All but 3 cases (in gcimporter.go and hixie.go) are automatic conversions using gofix. No attempt is made to use the new Append functions even though there are definitely opportunities. R=golang-dev, gri CC=golang-dev https://golang.org/cl/5447069
2011-11-08renaming_2: gofix -r go1pkgrename src/pkg/[a-l]*Rob Pike
R=rsc CC=golang-dev https://golang.org/cl/5358041
2011-11-07xml: allow parsing of <_> </_>.David Crawshaw
R=rsc, nigeltao CC=golang-dev https://golang.org/cl/5298061
2011-11-04gc: detect type switch variable not used cases.Luuk van Dijk
Fixes #873 Fixes #2162 R=rsc CC=golang-dev https://golang.org/cl/5341043
2011-11-03encoding: move asn1, csv, gob, json, xml into encodingRob Pike
This is Go 1 package renaming CL #1. This one merely moves the source; the import strings will be changed after the next weekly release. The only edits are in Makefiles. R=r, rsc CC=golang-dev https://golang.org/cl/5331060