OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Package xml implements a simple XML 1.0 parser that | 5 // Package xml implements a simple XML 1.0 parser that |
6 // understands XML name spaces. | 6 // understands XML name spaces. |
7 package xml | 7 package xml |
8 | 8 |
9 // References: | 9 // References: |
10 // Annotated XML spec: http://www.xml.com/axml/testaxml.htm | 10 // Annotated XML spec: http://www.xml.com/axml/testaxml.htm |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 r >= 0x10000 && r <= 0x10FFFF | 1019 r >= 0x10000 && r <= 0x10FFFF |
1020 } | 1020 } |
1021 | 1021 |
1022 // Get name space name: name with a : stuck in the middle. | 1022 // Get name space name: name with a : stuck in the middle. |
1023 // The part before the : is the name space identifier. | 1023 // The part before the : is the name space identifier. |
1024 func (d *Decoder) nsname() (name Name, ok bool) { | 1024 func (d *Decoder) nsname() (name Name, ok bool) { |
1025 s, ok := d.name() | 1025 s, ok := d.name() |
1026 if !ok { | 1026 if !ok { |
1027 return | 1027 return |
1028 } | 1028 } |
1029 » i := strings.Index(s, ":") | 1029 » i := strings.IndexByte(s, ':') |
1030 if i < 0 { | 1030 if i < 0 { |
1031 name.Local = s | 1031 name.Local = s |
1032 } else { | 1032 } else { |
1033 name.Space = s[0:i] | 1033 name.Space = s[0:i] |
1034 name.Local = s[i+1:] | 1034 name.Local = s[i+1:] |
1035 } | 1035 } |
1036 return name, true | 1036 return name, true |
1037 } | 1037 } |
1038 | 1038 |
1039 // Get name: /first(first|second)*/ | 1039 // Get name: /first(first|second)*/ |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1800 } | 1800 } |
1801 if v[0] != '\'' && v[0] != '"' { | 1801 if v[0] != '\'' && v[0] != '"' { |
1802 return "" | 1802 return "" |
1803 } | 1803 } |
1804 idx = strings.IndexRune(v[1:], rune(v[0])) | 1804 idx = strings.IndexRune(v[1:], rune(v[0])) |
1805 if idx == -1 { | 1805 if idx == -1 { |
1806 return "" | 1806 return "" |
1807 } | 1807 } |
1808 return v[1 : idx+1] | 1808 return v[1 : idx+1] |
1809 } | 1809 } |
OLD | NEW |