Ygg01 / xml5_draft

Draft for the XML5 proposal.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integrate Namespaces

Ygg01 opened this issue · comments

commented

I like XML Namespaces, they are simple and elegant, let's support them on tokenization level.

Basically extend the spec so if you encounter a : (not as first char of name) during parsing it starts parsing namespaces. You encounter another : and it will no longer consider the name fit for namespaces.

I think I had this implemented as well. I just looked for the first ":".

commented

Hm, what namespaces does <:foo> have? Default?

Yeah I think you need to require at least one character before and after. Otherwise it gets hairy.

To add though, I don't think I had this in the tokenizer but rather when you create elements. You need to keep the prefix around anyway so it doesn't really make sense to do it in the tokenizer.

commented

@annevk I was thinking way too much from my parser implementation. I think html5ever creates namespaces during tokenization.

But why would you do that? Also, I doubt that is the case for SVG in HTML and such.

commented

But why would you do that?

Well, it's implementation detail, but attributes/names in html5ever during tokenization are assigned QualName. Although, they are only processed in tree building phase.

To me it made more sense initially to parse them during tokenization, since you have a QualName during tokenization, but now since fragments were added, I saw they are meant to be processed in tree builder phase.