Reading this post made me thinking how exactly markup for a generic control should look like. It would be nice to have something that is SGML-compiliant syntax so we won’t have to special case anything in our parser. For example
<vc:SomeGenericControl<SomeObjectType> runat=”server” />
obviously is not SGML compliant because of nested angle brackets. It is difficult to parse this kind of constructs since it not different from
<input <div> some text />
which is plain ugly invalid HTML which has to be squiggled. Another one, proposed in the abovementioned post,
<vc:SomeGenericControl:SomeObjectType runat=”server” />
is better, but still is not quite compliant since only namespace:element pairs are allowed (W3C theoretically allows colons in element names, but namespace spec forbids them. However, it is relatively simple to add functionality to the HTML parser and make it recognize this kind of constructs.
Dot (period) is allowed in element names and this one
<vc:SomeGenericControl.SomeObjectType runat=”server” />
is a valid construct and in fact, XAML uses it extensively. However, now we will experience difficulties specifying more than a single type, i.e. in
<vc:SomeGenericControl.SomeObjectType1.SomeObjectType2 runat=”server” />
it is unclear if SomeObjectType1.SomeObjectType2 should be parsed as
<SomeObjectType1,SomeObjectType2> or as <SomeObjectType1.SomeObjectType2>.
So syntax with semicolons appears to be better in this fashion:
<vc:SomeGenericControl:SomeObjectType1.SubType1:SomeObjectType2.Type2 runat="server" />
Another way might be (as long as we accept that file is no longer SGML/XML compilant) to use braces
<vc:SomeGenericControl(SomeObjectType1.SubType1, SomeObjectType2.SubType2) runat="server" />
You are welcome to post your ideas in the feedback!