Re: [xml-dev] Static resolution of names is preferred over dynamic resolution of names
Hi,
I'm not sure I would use the terminology "compiling XML" as XML is not a programming language, but otherwise yes, I would assume that many processors optimize the internal representation of QNames in memory when processing XML. For example, you can use internal and fixed prefixes as namespace proxies, or you can have a namespace pool and use pointer comparison to compare namespaces, or have QName pools and compare QNames by pointer directly.
Kind regards,
Ghislain
On Thu, Apr 14, 2016 at 3:41 PM, Stephen Cameron <[email protected]> wrote:
So maybe one answer is to compile XML? Namespaces don't seem to be a problem in compiled code.On Thu, Apr 14, 2016 at 9:38 PM, Ghislain Fourny <[email protected]> wrote:Hi,XBRL (which is based on XML) is an interesting example for the way namespaces and QNames are handled. Technically, everything in there (concepts, units, types) is a QName, however there is a very widespread convention to stick to the same prefix binding at least within a regulatory authority. That way, one can rely on the prefix and local name, does not need to resolve to long names *even dynamically*, and one can optimize accordingly both in space and time.This convention is actually made explicit by several authorities such as the SEC in terms of recommended prefix usage, and a recent working draft in the XBRL specification family formalizes this approach as SQNames (= what Roger calls abbreviated QNames).Of course, it may not scale up as far as URI namespaces because you lose the "using a domain you own"-perk of URIs to avoid collisions, but so far it works pretty well because the number of namespaces is still reasonable at the scales considered.Kind regards,Ghislain