Skip to content

Commit 1f5dd99

Browse files
author
Tamer Gur
committed
Fixing issue #3 related with Peek function
1 parent cf60436 commit 1f5dd99

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

xmlparser.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -414,27 +414,26 @@ scan_declartions:
414414

415415
if a[0] == '<' {
416416

417-
// read peaked byte first
418-
_, err = x.readByte()
419-
if err != nil {
420-
return err
421-
}
422-
423-
b, err = x.reader.Peek(1)
417+
b, err = x.reader.Peek(2)
424418

425419
if err != nil {
426420
return err
427421
}
428422

429-
if b[0] == '!' || b[0] == '?' { // either comment or decleration
423+
if b[1] == '!' || b[1] == '?' { // either comment or decleration
430424

431-
// read peaked byte
425+
// read 2 peaked byte
432426
_, err = x.readByte()
433427

434428
if err != nil {
435429
return err
436430
}
437431

432+
_, err = x.readByte()
433+
if err != nil {
434+
return err
435+
}
436+
438437
c, err = x.readByte()
439438

440439
if err != nil {

0 commit comments

Comments
 (0)