Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is meaning of "xmlns:v=urn:schemas-microsoft-com" in HTML5

Tags:

html

xml

I happened to find the sentence "xmlns:v=urn:schemas-microsoft-com" as title described

Here is source roughly.

<!--[if gt IE 8]><!DOCTYPE html><!--<![endif]-->
<!DOCTYPE html><!--<![endif]-->
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><br>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <meta name="viewport" content="user-scalable=0,target-densitydpi=device-dpi">
        ...
    </head>
    <body>
        ...
    </body>
</html>

As I know xmlns is schema, so to speak metadata. If some element is available in body section, the metadata of this element exist in "schemas.microsft.com"

If I develop a html page using "microsoft" schema, all elements used in body section will be referernced by "microsoft" Or, If I use other schema, examply "google" (I don't know whether this really exist) all element goes same too.

Here is my question First, If I use table tag that exist in "microsoft" and "google" schema together Will chrome browser interpret context differently? so comes differnt view?

Second, If xmlns is omitted what kind of schema will be used default?

like image 780
trytop Avatar asked Sep 30 '22 08:09

trytop


2 Answers

The xmlns:* attributes are namespace definitions. Elements and attributes with the prefix/alias "v" or "o" are part of the respective namespace and not part of HTML. If parsed as HTML < 5 the namespaces will be ignored. In HTML 5 here some constructs for specific namespaces (SVG, MathML), but namespace definitions (the xmlns:* attributes) are ignored.

If parsed as XML the attributes define the namespaces. You have to definitions:

  • Alias vfor urn:schemas-microsoft-com:vml - the Vector Markup Language
  • Alias o for urn:schemas-microsoft-com:office:office - MS Office Open XML common attributes

XML namespaces allow to mix different XML formats and avoiding conflicts because of element names.

You file might be generated by MS Office (2003) or a user copied content from Office into it. If here are no elements/attributes starting with v: or o: in your document they don't do anything.

If the client knows a namespace/format it can interpret the elements. Not only a browser but RSS Readers, Calendars, ... If a client does not know a namespace but respects it, it at least knows to ignore the elements/attributes even if they have a name that might be valid in HTML.

like image 108
ThW Avatar answered Oct 17 '22 16:10

ThW


In HTML5 in text/html mode it has no meaning. It's an error that is interpreted as an attribute named xmlns:v which doesn't do anything.

In XHTML5 (HTML5 in application/xhtml+xml) it has same meaning as in XML: it declares that the prefix v is for namespace identified by urn:schemas-microsoft-com, but a mere declaration of a prefix doesn't do anything visible.

like image 1
Kornel Avatar answered Oct 17 '22 15:10

Kornel