RFC: declare the HTML namespace in the file format

Thanks for an interesting program. I just bought a license. For me, apart from the speediness an editing utility, what bought me over, was the fact that the file format of Bike is HTML. And actually, it is XML-compliant, as well.

Hence, my RFC (Request For Enhancement):

Make the file format XHTML-compatible as well, by declaring the HTML namespace on the <html> element, like so:

<html xmlns="http://www.w3.org/1999/xhtml">


  1. By adding the namespace to the file format, we avoid the following “fight” between user and application: Currently, if the user does declare the namespace manually (by editing the Bike HTML code in an editor), Bike will delete the namespace once you continue to edit the file in Bike.
  2. Once the namespace is declared, it would permit users to use .xhtml, .xht, or .xml as file suffixes, and permit the user to displayed the files as XHTML in all current Web browers.
  3. For anyone using a XHTML-compatible editor, it would allow direct editing of the Bike file in those editors.

Negative effects

I do not see any negative effects

Alternative solution

As an alternative to adding the HTML namespace declaration to the file format, I could live with Bike not deleting the namespace if someone adds it.

Further options …

I would not mind if you added the <title> element and the <!DOCTYPE HTML> declaration as well, however those are not as crucial, for myself.


Maybe … I just changed in my local copy and everything still seems to work.

My worry is that I’m somehow over-specifying/promising by doing this. Also, I don’t really understand all the intricacies of XML namespaces. So some questions:

  1. Bike is a subset of html. It only recognizes a certain configuration of html elements. I think that configuration “mostly” falls into xmlns="http://www.w3.org/1999/xhtml", but it’s certainly not case that Bike can read any xhtml document. Still make sense to declare the namespace.

  2. This might be problem with current setup too… but there are some attributes that Bike uses that I don’t think are part of any standard. For example sometimes Bike will include a “indent” attribute. Will that cause problems if I also add xmlns? I imagine maybe it wouldn’t validate?

permit the user to displayed the files as XHTML in all current Web browers.

Stupid question, but what does this actually mean? I “think” it looks the same in Safari when I add or do not add that attribute.

1 Like

Thanks for considering this RFC!

A quick reply before bed … Sorry for being longish.

(3) Last issue first: What did I mean by «permit the user to displayed the files as XHTML in all current Web browers»?

Well, I can understand that it was perhaps unclear. Bike allows us to use whatever file suffix we want. Which is kind of cool! And so, we can already use the .xhtml suffix. And you should - already - be able to open a “bike.xhtml” file in whatever browser you like.

But, XHTML is actually XML - and XML is less “automatic” than HTML is.

For “regular” HTML (that is: non-XML-HTML), the namespace is not necessary to declare - even if you do not declare it, the namespace of HTML already is xmlns="http://www.w3.org/1999/xhtml". And it does not matter whether you declare it or not. It is permitted to declare it, but it does not have any effect.

Whereas for XHTML - which as I said, really is XML (which is a general format used for many markup languages) - for XHTML, it is necessary to declare the namespace. Yes, XML without the HTML namespace, is not XHTML - if that makes sense.

The effect of the HTML namespace, is related to the (default) CSS and other default behaviors. This effect is the same for non-XML-HTML as for XML-HTML (also known as XHTML). The difference is only - or at least primarily - that for XHTML, it is necessary to declare the namespace.

So if you save a bike file as “bike.xhtml” and open it in Firefox or another browser, the browser will tell you that the document has no style sheet information. And hence, it will be very uninteresting to look at the document.

But if you add the namespace declaration to the html element, the browser will know which default CSS to add to the document.

So in a summary, with the namespace declaration present, the browser will interpret the file (almost) the same way regardless of whether you save the file as “bike.html” or as “bike.xhtml”.

As for your first question:

(2) Bike’s indent attribute: I have not looked at the indent attribute. I did not know Bike used it. But this sounds like custom attribute that you have created. The HTML5 specification (which governs both HTML5 and XHTML5) has some rules for how to create custom attributes. The most general approach would be to create a data- attribute - something like this: data-indent="" . This would be valid, out of the box. (There are also more involved way to create custom attributes - but I am not prepared to say more than this, right now.)

Anyway, to answer your question: even if you just do indent="" , it is perfectly “safe” to add the namespace declaration. It is not related to the namespace declaration at all. It is perfectly OK, from XHTML’s point of view, to add custom attributes on XHTML.

I could imagine that your question is related to old days when XHTML sometimes was considered to be more “semantic” than HTML. And so, you fear that if you add a “unsemantic” indent="" attribute, that this somehow break anything.

Or, another way I could understand your question: To declare an attribute as valid, can be a very involved process, if we are dealing with XML. But XML has two levels of “validity”: It has well-formedness - anything that isn’t well formed, will not be rendered by the browser. And the second level is “valid”. For something to be “valid”, there must exist a meta-document somewhere which declares certain elements and attributes as “valid”. (By “meta-document” I mean document type declarations and that kind of stuff.)

But for XHTML5 (and HTML5) one removed the requirement for such a “meta document” - at least when it comes to browsers. (For XHTML editors, then they typically operate with some kind of knowledge of which attributes and element are valid - but even an XHTML editor should be able to handle custom attributes.)

But, once again, use of custom attributes is not incompatible with the HTML namespace declaration. But I would recommend using data-indent="" (unless doing so somehow destroys your project …) But – NB – this recommendation has nothing to do with XHTML vs HTML.

There is just one thing to be aware of when it comes to attributes in XML (including XHTML): If the indent="" takes a value, then you must include the quotes: indent="<value>" . You cannot do indent=<value> . And if the attribute is an on/off attribute, which does not take a value (that is: if the attribute changes the behavior of its element simply by its presence), then, for XML-compatibility, you must do indent="". I.e you must do <foo indent="">. You cannot simply do <foo indent >

(1) Adding the namespace declaration is not a promise. Just because someone adds the HTML namespace declaration to a HTML file, does not mean that the file MUST be XHTML. As I said, the HTML5 specification permits the namespace declaration to be present (on any element), without requiring that the document otherwise is XHTML compliant.

Sorry for my long reply. Hope it made some sense.

1 Like