Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
490c3d4a
Commit
490c3d4a
authored
Feb 24, 2012
by
Gustavo Niemeyer
Committed by
Russ Cox
Feb 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encoding/xml: fix anonymous field Unmarshal example
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/5697043
parent
04f110e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
src/pkg/encoding/xml/example_test.go
src/pkg/encoding/xml/example_test.go
+4
-3
No files found.
src/pkg/encoding/xml/example_test.go
View file @
490c3d4a
...
...
@@ -52,7 +52,7 @@ func ExampleMarshalIndent() {
// This example demonstrates unmarshaling an XML excerpt into a value with
// some preset fields. Note that the Phone field isn't modified and that
// the XML <
address
> element is ignored. Also, the Groups field is assigned
// the XML <
Company
> element is ignored. Also, the Groups field is assigned
// considering the element path provided in its tag.
func
ExampleUnmarshal
()
{
type
Email
struct
{
...
...
@@ -71,11 +71,11 @@ func ExampleUnmarshal() {
Address
}
v
:=
Result
{
Name
:
"none"
,
Phone
:
"none"
}
v
.
Address
=
Address
{
"Hanga Roa"
,
"Easter Island"
}
data
:=
`
<Person>
<FullName>Grace R. Emlin</FullName>
<Company>Example Inc.</Company>
<Email where="home">
<Addr>gre@example.com</Addr>
</Email>
...
...
@@ -86,7 +86,8 @@ func ExampleUnmarshal() {
<Value>Friends</Value>
<Value>Squash</Value>
</Group>
<Address>123 Main Street</Address>
<City>Hanga Roa</City>
<State>Easter Island</State>
</Person>
`
err
:=
xml
.
Unmarshal
([]
byte
(
data
),
&
v
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment