Should prefixes be used in HTML5 elements? [duplicate]

1

I noticed in the HTML5 documentation that the xmlns attribute on the root element html is still allowed. This attribute, according to my study, assigns a "unique qualified name" to the element associating with the namespace (attribute value), not only for it, but for all its other child elements that do not have another attribute declaration xmlns different. It does not matter whether the attribute has a prefix present ( xmlns:prefixo="url" ) or not ( xmlns="url" ). Note that the address used to identify the namespace is not used by the parser to fetch information. The sole purpose is to give the namespace a "unique qualified name". Ufa! Question: Should we still use prefixes in HTML5 tags? Is there a real example of using HTML5? It seems to me that it still exists because of the natural process of transition between languages, otherwise it would not even be there, is it? Thank you!

<!DOCTYPE html>
<html xmlns:book="http://www.book.com">
   <book:head>
      ...
   </book:head>
   <book:body>
       <book:h1>Title</book:h1>
       ...
   </book:body>
</html>
    
asked by anonymous 25.03.2016 / 21:48

1 answer

3

The use of this is totally optional, there are basically patterns and they can be "extensible", but it does not mean that you are forced to use something.

Generally we use when we merge some kind of XML markup, but it's totally geared towards when you're going to create a more custom custom , summarizing if you want to create a markup for the purpose of make your HTML visible or usable in other types of technologies besides conventional browsers, now if the site you want to create is just for browsing even if you use something like that it is totally useless.

There are several designs and standards that W3C (not to confuse with w3schools) develops, even XHTML and HTML separation, there was even XHTML2.0 (which if I'm not mistaken was discontinued to support HTML5).

Follow this if you are going to create a webpage to navigate, stay in basic HTML / HTML5 if you need an advanced markup like Facebook Open Graph (as <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml"> ) so HTML5 supports normally without needing to apply XHTML, basically today HTML5 supports several features that would be XHTML, which makes a great deal expendable.

Even though there is still a project called XHTML5, in Xhtml you are required to make a "good markup."

To summarize the use of xmlns:book is a namespace , (xmlns stands for Xml NameSpace) and will be used to avoid conflicts, like tags that repeat names, this is a solution for XML, but can be applied to XHTML (since the same is an XML), assuming you have to use 2 different xml types within HTML and both have a similar tag can occur problems, in case the namespace is to avoid this type of conflict, then you can associate one XML to one namespace and another XML to another namespace, this is similar in programming languages that have classes with the same name, so we use namespaces to avoid the conflict.

  

This question is being edited, as soon as possible I will add an example of conflict.

    
25.03.2016 / 23:11