Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
e57acdca
Commit
e57acdca
authored
Nov 05, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gofmt-ify parts of xml
R=rsc
http://go/go-review/1017049
parent
12dbd06f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
34 deletions
+35
-34
read.go
src/pkg/xml/read.go
+8
-7
read_test.go
src/pkg/xml/read_test.go
+27
-27
No files found.
src/pkg/xml/read.go
View file @
e57acdca
...
@@ -127,6 +127,7 @@ func Unmarshal(r io.Reader, val interface{}) os.Error {
...
@@ -127,6 +127,7 @@ func Unmarshal(r io.Reader, val interface{}) os.Error {
// An UnmarshalError represents an error in the unmarshalling process.
// An UnmarshalError represents an error in the unmarshalling process.
type
UnmarshalError
string
type
UnmarshalError
string
func
(
e
UnmarshalError
)
String
()
string
{
func
(
e
UnmarshalError
)
String
()
string
{
return
string
(
e
);
return
string
(
e
);
}
}
...
@@ -172,12 +173,12 @@ func (p *Parser) unmarshal(val reflect.Value, start *StartElement) os.Error {
...
@@ -172,12 +173,12 @@ func (p *Parser) unmarshal(val reflect.Value, start *StartElement) os.Error {
}
}
var
(
var
(
data
[]
byte
;
data
[]
byte
;
saveData
reflect
.
Value
;
saveData
reflect
.
Value
;
comment
[]
byte
;
comment
[]
byte
;
saveComment
reflect
.
Value
;
saveComment
reflect
.
Value
;
sv
*
reflect
.
StructValue
;
sv
*
reflect
.
StructValue
;
styp
*
reflect
.
StructType
;
styp
*
reflect
.
StructType
;
)
)
switch
v
:=
val
.
(
type
)
{
switch
v
:=
val
.
(
type
)
{
case
*
reflect
.
BoolValue
:
case
*
reflect
.
BoolValue
:
...
@@ -232,7 +233,7 @@ func (p *Parser) unmarshal(val reflect.Value, start *StartElement) os.Error {
...
@@ -232,7 +233,7 @@ func (p *Parser) unmarshal(val reflect.Value, start *StartElement) os.Error {
ns
:=
""
;
ns
:=
""
;
i
:=
strings
.
LastIndex
(
tag
,
" "
);
i
:=
strings
.
LastIndex
(
tag
,
" "
);
if
i
>=
0
{
if
i
>=
0
{
ns
,
tag
=
tag
[
0
:
i
],
tag
[
i
+
1
:
len
(
tag
)];
ns
,
tag
=
tag
[
0
:
i
],
tag
[
i
+
1
:
len
(
tag
)];
}
}
if
tag
!=
start
.
Name
.
Local
{
if
tag
!=
start
.
Name
.
Local
{
return
UnmarshalError
(
"expected element type <"
+
tag
+
"> but have <"
+
start
.
Name
.
Local
+
">"
);
return
UnmarshalError
(
"expected element type <"
+
tag
+
"> but have <"
+
start
.
Name
.
Local
+
">"
);
...
...
src/pkg/xml/read_test.go
View file @
e57acdca
...
@@ -78,38 +78,38 @@ not being used from outside intra_region_diff.py.
...
@@ -78,38 +78,38 @@ not being used from outside intra_region_diff.py.
</summary></entry></feed>`
</summary></entry></feed>`
type
Feed
struct
{
type
Feed
struct
{
XMLName
Name
"http://www.w3.org/2005/Atom feed"
;
XMLName
Name
"http://www.w3.org/2005/Atom feed"
;
Title
string
;
Title
string
;
Id
string
;
Id
string
;
Link
[]
Link
;
Link
[]
Link
;
Updated
Time
;
Updated
Time
;
Author
Person
;
Author
Person
;
Entry
[]
Entry
;
Entry
[]
Entry
;
}
}
type
Entry
struct
{
type
Entry
struct
{
Title
string
;
Title
string
;
Id
string
;
Id
string
;
Link
[]
Link
;
Link
[]
Link
;
Updated
Time
;
Updated
Time
;
Author
Person
;
Author
Person
;
Summary
Text
;
Summary
Text
;
}
}
type
Link
struct
{
type
Link
struct
{
Rel
string
"attr"
;
Rel
string
"attr"
;
Href
string
"attr"
;
Href
string
"attr"
;
}
}
type
Person
struct
{
type
Person
struct
{
Name
string
;
Name
string
;
URI
string
;
URI
string
;
Email
string
;
Email
string
;
}
}
type
Text
struct
{
type
Text
struct
{
Type
string
"attr"
;
Type
string
"attr"
;
Body
string
"chardata"
;
Body
string
"chardata"
;
}
}
type
Time
string
type
Time
string
...
@@ -124,7 +124,7 @@ var rssFeed = Feed{
...
@@ -124,7 +124,7 @@ var rssFeed = Feed{
Id
:
"http://codereview.appspot.com/"
,
Id
:
"http://codereview.appspot.com/"
,
Updated
:
"2009-10-04T01:35:58+00:00"
,
Updated
:
"2009-10-04T01:35:58+00:00"
,
Author
:
Person
{
Author
:
Person
{
Name
:
"rietveld"
Name
:
"rietveld"
,
},
},
Entry
:
[]
Entry
{
Entry
:
[]
Entry
{
Entry
{
Entry
{
...
@@ -134,7 +134,7 @@ var rssFeed = Feed{
...
@@ -134,7 +134,7 @@ var rssFeed = Feed{
},
},
Updated
:
"2009-10-04T01:35:58+00:00"
,
Updated
:
"2009-10-04T01:35:58+00:00"
,
Author
:
Person
{
Author
:
Person
{
Name
:
"email-address-removed"
Name
:
"email-address-removed"
,
},
},
Id
:
"urn:md5:134d9179c41f806be79b3a5f7877d19a"
,
Id
:
"urn:md5:134d9179c41f806be79b3a5f7877d19a"
,
Summary
:
Text
{
Summary
:
Text
{
...
@@ -170,7 +170,7 @@ feedback on the right way to get the two values at
...
@@ -170,7 +170,7 @@ feedback on the right way to get the two values at
the top of feeds.py marked NOTE(rsc).
the top of feeds.py marked NOTE(rsc).
`
`
,
},
},
},
},
Entry
{
Entry
{
...
@@ -180,7 +180,7 @@ the top of feeds.py marked NOTE(rsc).
...
@@ -180,7 +180,7 @@ the top of feeds.py marked NOTE(rsc).
},
},
Updated
:
"2009-10-03T23:02:17+00:00"
,
Updated
:
"2009-10-03T23:02:17+00:00"
,
Author
:
Person
{
Author
:
Person
{
Name
:
"email-address-removed"
Name
:
"email-address-removed"
,
},
},
Id
:
"urn:md5:0a2a4f19bb815101f0ba2904aed7c35a"
,
Id
:
"urn:md5:0a2a4f19bb815101f0ba2904aed7c35a"
,
Summary
:
Text
{
Summary
:
Text
{
...
@@ -203,8 +203,8 @@ call sites. I also wanted to verify that ExpandTabs was
...
@@ -203,8 +203,8 @@ call sites. I also wanted to verify that ExpandTabs was
not being used from outside intra_region_diff.py.
not being used from outside intra_region_diff.py.
`
`
,
}
}
,
},
},
}
}
,
}
}
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