Here’s an item in the spec which I’m having trouble understanding: When the [[AddInScopeNamespace]] method of an XML object x is called with a namespace N, the following steps are taken: 1. If x.[[Class]] ∈ {"text", "comment", "processing-instruction", “attribute”}, return 2. If N.prefix != undefined a. If N.prefix == "" and x.[[Name]].uri == "", return b. Let match be null c. For each ns in x.[[InScopeNamespaces]] i. If N.prefix == ns.prefix, let match = ns d. If match is not null and match.uri is not equal to N.uri i. Remove match from x.[[InScopeNamespaces]] e. Let x.[[InScopeNamespaces]] = x.[[InScopeNamespaces]] ∪ { N } f. If x.[[Name]].[[Prefix]] == N.prefix i. Let x.[[Name]].prefix = undefined g. For each attr in x.[[Attributes]] i. If attr.[[Name]].[[Prefix]] == N.prefix, let attr.[[Name]].prefix = undefined 3. Return
I do not understand e through g. It looks like the spec says you are supposed to remove the prefixes of the XML which has the namespace added to it if the prefix matches the added namespace. Why would you do that? On Jan 7, 2016, at 11:53 PM, Harbs <harbs.li...@gmail.com> wrote: > Next item: > > I’m working on namespaces and QNames. > > E4X allows the specification of default namespaces like this: > > default xml namespace = "http://ns.adobe.com/mxml/2009”; > > This causes all elements created after this statement to act as if they were > declared like this: > <elem xmlns="http://ns.adobe.com/mxml/2009”/> (notice, no prefix) > > I’m not sure how commonly used this feature is, but we should probably map > this statement to some kind of static method. We can either attach it to XML, > or Namespace. > > (I’ve learned more than I care to know about E4X in the past few weeks. I > have the E4X spec coming out of my ears…) ;-) > > On Jan 5, 2016, at 7:12 PM, Alex Harui <aha...@adobe.com> wrote: > >> >> >> On 1/5/16, 7:49 AM, "Harbs" <harbs.li...@gmail.com> wrote: >> >>> BTW, I’m not sure what we said about myXML.@foo = “baz” or myXML.@ba:foo >>> = “baz”. >>> >>> Are we mapping that to myXML.setChild(“@foo”,”baz”) and >>> myXML.setChild(“@ba:foo”,”baz”), or are we creating a separate function >>> for attributes? >> >> I tried it and got an exception. So I just pushed a fix for that where it >> will call >> >> myXML.setAttribute(“foo”,”baz”) >> >> >> I'm going to spend some time on XML and the compiler today. >> >> -Alex >> >