Commit bc4891a0 authored by Paul Warren's avatar Paul Warren
Browse files

Merge branch 'master' of https://code.blinkace.com/go/xml

parents 85412913 726e67ca
= Go XML tools =
Go XML tools
============
== code.blinkace.com/go/xml/encoding/xml ==
code.blinkace.com/go/xml/encoding/xml
=====================================
This is a fork of the standard encoding/xml with a number of changes, primarily
to deal with elements and attributes containing QName values.
(see https://github.com/golang/go/issues/12406)
In addition, it provides Encoder.XMLDeclaration to control the inclusion of an
XML declaration in the output.
== code.blinkace.com/go/xml/qname ==
code.blinkace.com/go/xml/qname
==============================
This package provides a QName type that implements the following interfaces
from the above package:
......
......@@ -75,6 +75,15 @@ func UnmarshallQNameAttr(d *xml.Decoder, s xml.StartElement, a QName) (QName, er
return q, nil
}
func (qname *QName) UnmarshalXMLAttr(d *xml.Decoder, attr xml.Attr) error {
q, err := NewFromString(d.NamespaceBindings(), attr.Value)
if err != nil {
return err
}
*qname = q
return nil
}
func (qname *QName) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
prefix := e.GetPrefix(qname.Namespace)
e.EncodeToken(start)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment