Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Describe how XML namespace support works #166

Closed
jclark opened this issue May 31, 2019 · 4 comments
Closed

Describe how XML namespace support works #166

jclark opened this issue May 31, 2019 · 4 comments
Assignees
Labels
Area/Lang Relates to the Ballerina language specification spec/improve Something that should be improved in the spec status/inprogress Fixes are in the process of being added
Milestone

Comments

@jclark
Copy link
Collaborator

jclark commented May 31, 2019

The spec describes the syntax for describing an XML namespace, but we don't completely describe the effect that this is supposed to have. If we have a xmlns decl for a prefix p as namespace uri, then in certain situations a qualified identifier p:ident is supposed to turn into an expanded name {uri}ident.

This is an important point, because it was part of the motivation for using prefix:name as the qualified identifier syntax.

Relates to #85.

@jclark jclark added the Area/Lang Relates to the Ballerina language specification label May 31, 2019
@jclark jclark added this to the 2019R2 milestone May 31, 2019
@jclark jclark added design/incomplete Part of design not yet worked out spec/improve Something that should be improved in the spec labels May 31, 2019
@jclark jclark mentioned this issue Jun 3, 2019
@jclark jclark self-assigned this Jun 4, 2019
@jclark jclark modified the milestones: 2019R2, 2019R4 Jun 4, 2019
@jclark
Copy link
Collaborator Author

jclark commented Jun 15, 2019

Need to think about where we have imported a module as foo, but still want to be able to use foo as an XML namespace prefix. A special case of this is xml where it is natural to want to import the lang.xml module as xml but we also need to use the xml as a namespace prefix.

@jclark jclark modified the milestones: 2019R5, 2020R1 Dec 21, 2019
@jclark
Copy link
Collaborator Author

jclark commented Feb 26, 2020

Things that need to be said:

  • [done] xml import prefix predeclared and overrideable
  • [done] xml:space etc included in lang.xml
  • [done] xmlns namespace prefix predeclared and not overrideable
  • [done] which namespace attributes are added when constructing from xml infoset
  • [done] namespace attribute handling on serialization
  • [done] foo:bar works as string, if foo is a namespace prefix (do we need this if we have x.foo:bar = "baz"?)

@rdhananjaya
Copy link
Member

Could you please elaborate on second point xmlns:space etc included in lang.xml a bit.

@jclark
Copy link
Collaborator Author

jclark commented Mar 10, 2020

I meant xml:space. The idea is that lang.xml does:

const space = "{http://www.w3.org/XML/1998/namespace}space";

This is so you can say:

xml:Element e;
map<string> atts = e.getAttributes();
string? s = atts[xml:space];

Thus the xml prefix (which is a module prefix) will work like prefixes that are defined as namespace prefixes.

It should also work for . and ?. e.g.

xml:Element e;
string? s = e?.xml:space;

but the spec doesn't cover this yet.

jclark added a commit that referenced this issue Mar 13, 2020
jclark added a commit that referenced this issue Mar 13, 2020
jclark added a commit that referenced this issue Mar 13, 2020
jclark added a commit that referenced this issue Mar 13, 2020
@jclark jclark added status/inprogress Fixes are in the process of being added and removed design/incomplete Part of design not yet worked out labels Mar 13, 2020
jclark added a commit that referenced this issue Mar 13, 2020
jclark added a commit that referenced this issue Mar 13, 2020
jclark added a commit that referenced this issue Mar 14, 2020
jclark added a commit that referenced this issue Mar 14, 2020
jclark added a commit that referenced this issue Mar 15, 2020
@jclark jclark closed this as completed Mar 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Lang Relates to the Ballerina language specification spec/improve Something that should be improved in the spec status/inprogress Fixes are in the process of being added
Projects
None yet
Development

No branches or pull requests

2 participants