Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5310)

Issue 6856092: encoding/xml: namespace inheritance and prefixes on att... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 5 months ago by cjyar
Modified:
11 years, 4 months ago
Reviewers:
Visibility:
Public.

Description

encoding/xml: namespace inheritance and prefixes on attributes This is a fix for Issue 3526, though I'd like to write more tests if reviewers think I'm on the right track. The central idea is that each XML element has a context which includes a mapping between prefixes and URIs, as well as the namespace of that element. This allows attributes to have different namespaces from their parent elements, as well as the canonical "HTML table and coffee table" example from http://www.w3.org/TR/REC-xml-names/. Problems with this approach: 1. We can't add a new Prefix field to xml.Name, because it breaks source compatibility. 2. That means there's no good way to load namespace context at runtime, before calling Marshal() or Unmarshal(). This is an important bit of functionality, for cases when the user wants to start in the middle of a document. It should be possible to work around by creating a fake top-level element with the appropriate context, but that seems hackish. 3.There's no way to add a new prefix to this element strictly for the benefit of its child elements. I'll expand on these a bit on golang-nuts.

Patch Set 1 #

Patch Set 2 : diff -r 107e46216b58 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+141 lines, -33 lines) Patch
A src/pkg/encoding/xml/namespace.go View 1 1 chunk +54 lines, -0 lines 0 comments Download
M src/pkg/encoding/xml/read.go View 1 11 chunks +39 lines, -12 lines 0 comments Download
M src/pkg/encoding/xml/typeinfo.go View 1 13 chunks +48 lines, -21 lines 0 comments Download

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b