aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/encoding/xml/xml.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/encoding/xml/xml.go')
-rw-r--r--libgo/go/encoding/xml/xml.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/libgo/go/encoding/xml/xml.go b/libgo/go/encoding/xml/xml.go
index 6f9594d..c14954d 100644
--- a/libgo/go/encoding/xml/xml.go
+++ b/libgo/go/encoding/xml/xml.go
@@ -261,7 +261,7 @@ func NewTokenDecoder(t TokenReader) *Decoder {
// call to Token. To acquire a copy of the bytes, call CopyToken
// or the token's Copy method.
//
-// Token expands self-closing elements such as <br/>
+// Token expands self-closing elements such as <br>
// into separate start and end elements returned by successive calls.
//
// Token guarantees that the StartElement and EndElement
@@ -768,6 +768,12 @@ func (d *Decoder) rawToken() (Token, error) {
}
b0, b1 = b1, b
}
+
+ // Replace the comment with a space in the returned Directive
+ // body, so that markup parts that were separated by the comment
+ // (like a "<" and a "!") don't get joined when re-encoding the
+ // Directive, taking new semantic meaning.
+ d.buf.WriteByte(' ')
}
}
return Directive(d.buf.Bytes()), nil
@@ -1156,8 +1162,9 @@ func (d *Decoder) nsname() (name Name, ok bool) {
if !ok {
return
}
- i := strings.Index(s, ":")
- if i < 0 {
+ if strings.Count(s, ":") > 1 {
+ name.Local = s
+ } else if i := strings.Index(s, ":"); i < 1 || i > len(s)-2 {
name.Local = s
} else {
name.Space = s[0:i]