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
bad9738b
Commit
bad9738b
authored
Nov 14, 2009
by
Abhinav Gupta
Committed by
Russ Cox
Nov 14, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xml: Fixed CDATA parsing.
Fixes #128. R=r, rsc
https://golang.org/cl/154126
parent
14a4ece9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
xml.go
src/pkg/xml/xml.go
+2
-2
xml_test.go
src/pkg/xml/xml_test.go
+7
-3
No files found.
src/pkg/xml/xml.go
View file @
bad9738b
...
...
@@ -497,11 +497,11 @@ func (p *Parser) RawToken() (Token, os.Error) {
case
'['
:
// <![
// Probably <![CDATA[.
for
i
:=
0
;
i
<
7
;
i
++
{
for
i
:=
0
;
i
<
6
;
i
++
{
if
b
,
ok
=
p
.
getc
();
!
ok
{
return
nil
,
p
.
err
}
if
b
!=
"
[
CDATA["
[
i
]
{
if
b
!=
"CDATA["
[
i
]
{
p
.
err
=
SyntaxError
(
"invalid <![ sequence"
);
return
nil
,
p
.
err
;
}
...
...
src/pkg/xml/xml_test.go
View file @
bad9738b
...
...
@@ -24,7 +24,7 @@ const testInput = `
<inner/>
</outer>
<tag:name>
Some text here.
<![CDATA[Some text here.]]>
</tag:name>
</body><!-- missing final newline -->`
...
...
@@ -52,7 +52,9 @@ var rawTokens = []Token{
EndElement
{
Name
{
""
,
"outer"
}},
CharData
(
strings
.
Bytes
(
"
\n
"
)),
StartElement
{
Name
{
"tag"
,
"name"
},
nil
},
CharData
(
strings
.
Bytes
(
"
\n
Some text here.
\n
"
)),
CharData
(
strings
.
Bytes
(
"
\n
"
)),
CharData
(
strings
.
Bytes
(
"Some text here."
)),
CharData
(
strings
.
Bytes
(
"
\n
"
)),
EndElement
{
Name
{
"tag"
,
"name"
}},
CharData
(
strings
.
Bytes
(
"
\n
"
)),
EndElement
{
Name
{
""
,
"body"
}},
...
...
@@ -83,7 +85,9 @@ var cookedTokens = []Token{
EndElement
{
Name
{
"ns2"
,
"outer"
}},
CharData
(
strings
.
Bytes
(
"
\n
"
)),
StartElement
{
Name
{
"ns3"
,
"name"
},
nil
},
CharData
(
strings
.
Bytes
(
"
\n
Some text here.
\n
"
)),
CharData
(
strings
.
Bytes
(
"
\n
"
)),
CharData
(
strings
.
Bytes
(
"Some text here."
)),
CharData
(
strings
.
Bytes
(
"
\n
"
)),
EndElement
{
Name
{
"ns3"
,
"name"
}},
CharData
(
strings
.
Bytes
(
"
\n
"
)),
EndElement
{
Name
{
"ns2"
,
"body"
}},
...
...
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