Dave Remy writes about XName and expanded names in XLinq and he wants feedback. Here we go.
I personally just love this feature. Expanded name is a core XML notion that exists since early days of XML. Obviously XLinq didn't invented it, XPath, XML Namespaces, XSLT and XQuery all use expanded name as an abstraction for an XML name. Where XLinq innovates is providing concrete syntax representation for an expanded name. In XML in general and XQuery particular expanded name has no syntax and you probably can guess that's not just a whim. There are some issues, you know.
First - it's all plain strings - no syntax checking help from C# compiler, you going to be informed about invalid expanded name only at runtime. Curiously enough at the moment XLinq isn't smart enough to detect that there is something wrong in "new XElement("{dd}d}foo")". This compiles and even runs ok :)
Those numerous string concatenations/validations/tokenizings...
Every other XML API and XML itself uses prefixes. Leaving them out sure is too dramatical step and will confuse lots of not-so-advanced-in-XML developers. Curretly XLinq seems to be way to liberal, down to being no-namespace aware - you can create an element p:foo with no namespace declared for prefix "p" and XLinq won't complain. You customer would though.
Unfortunately I don't believe you can ignore prefixes completely, despite QNames in content considered harmful, they are ubiquitous. So XLinq have to clutter API provide some facilities to work with QNames and prefixes like you it or not. What about "prefix{ns-name}localname" triple syntax form? :)
Simplify is a good mantra though.
Good point, kokos. The same string in quotes with implicit syntax again.
isn't it strange that in trying to get rid of "select *" we end up with "prefix{ns-name}localname"...?
i know one is dlinq and the other xlinq but it doesn't look right to me