Apply name space translation to name n. The default name space (for Space=="") applies only to element names, not to attribute names.
(n *Name, isElementName bool)
| 330 | // The default name space (for Space=="") |
| 331 | // applies only to element names, not to attribute names. |
| 332 | func (d *Decoder) translate(n *Name, isElementName bool) { |
| 333 | switch { |
| 334 | case n.Space == "xmlns": |
| 335 | return |
| 336 | case n.Space == "" && !isElementName: |
| 337 | return |
| 338 | case n.Space == "xml": |
| 339 | n.Space = xmlURL |
| 340 | case n.Space == "" && n.Local == "xmlns": |
| 341 | return |
| 342 | } |
| 343 | if v, ok := d.ns[n.Space]; ok { |
| 344 | n.Space = v |
| 345 | } else if n.Space == "" { |
| 346 | n.Space = d.DefaultSpace |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | func (d *Decoder) switchToReader(r io.Reader) { |
| 351 | // Get efficient byte at a time reader. |