Skip to content

Commit b62e0c7

Browse files
committed
fix issue 19
1 parent a096e9d commit b62e0c7

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/tamerh/xml-stream-parser
2+
3+
go 1.12
4+
5+
require github.com/tamerh/xpath v1.0.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/tamerh/xpath v1.0.0 h1:NccMES/Ej8slPCFDff73Kf6V1xu9hdbuKf2RyDsxf5Q=
2+
github.com/tamerh/xpath v1.0.0/go.mod h1:t0wnh72FQlOVEO20f2Dl3EoVxso9GnLREh1WTpvNmJQ=

sample.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
</tag1>
1919
<!-- some comments <> "" '' -->
2020
<tag1 att1="<att1>" att2="att1">
21-
<tag11 att1="att1">InnerText2</tag11>
22-
<tag12 att1="att1"/>
21+
<tag11 att1= "att1">InnerText2</tag11>
22+
<tag12 att1=
23+
"att1"/>
2324
<tag13>InnerText213</tag13>
2425
<tag14 />
2526
</tag1>

xmlparser.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,13 @@ search_close_tag:
425425
return nil, false, x.defaultError()
426426
}
427427

428+
for x.isWS(cur) {
429+
cur, err = x.readByte()
430+
if err != nil {
431+
return nil, false, x.defaultError()
432+
}
433+
}
434+
428435
if !(cur == '"' || cur == '\'') {
429436
return nil, false, x.defaultError()
430437
}
@@ -842,7 +849,7 @@ func (x *XMLParser) string(start byte) (string, error) {
842849
}
843850

844851
// scratch taken from
845-
//https://github.com/bcicen/jstream
852+
// https://github.com/bcicen/jstream
846853
type scratch struct {
847854
data []byte
848855
fill int

0 commit comments

Comments
 (0)