Xmlns= Versus meta http-equiv=

The argument was not that you don’t understand the concepts, but that your choice of vocabulary was incorrect, and your ambiguous explanations made what you were saying confusing. Your statements could therefore easily be misinterpreted by someone who doesn’t understand what XHTML is about as saying “you can add any elements you want to XHTML without conditions, because that’s what the X means”. This could lead people to create some very poor implementations of XHTML. :slight_smile:

PS - if you create a DTD for <schön> per your example, you would only be able to include it in a valid XHTML doc in a separate namespace, e.g. <noon:schön> where xmlns:noon=“the://schön/namespace/uri” (assuming your XHTML is the default NS)

No.

I would use a “root” element, like html for HTML, where I would declare once the namespace for that “root”, that would extend to all its children.

I would have to use it the way you say, only if I have mixed elements next to each other, elements from different namespaces thrown into the a mix.

Here is a clear example for your misunderstanding.
https://developer.mozilla.org/en/svg_in_html_introduction


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XTech SVG Demo</title>
<style>
stop.begin { stop-color:yellow; }
stop.end { stop-color:green; }
body.invalid stop.end { stop-color:red; }
#err { display:none; }
body.invalid #err { display:inline; }
</style>
<script>
function signalError() {
document.getElementById('body').setAttribute("class", "invalid");
}
</script>
</head>
<body id="body"
style="position:absolute; z-index:0; border:1px solid black; left:5%; top:5%; width:90%; height:90%;">
<form>
<fieldset>
<legend>HTML Form</legend>
<p><label>Enter something:</label>
<input type="text"/>
<span id="err">Incorrect value!</span></p>
<p><input type="button" value="Activate!" onclick="signalError();" /></p>
</fieldset>
</form>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
viewBox="0 0 100 100" preserveAspectRatio="xMidYMid slice"
style="width:100%; height:100%; position:absolute; top:0; left:0; z-index:-1;">
<linearGradient id="gradient">
<stop class="begin" offset="0%"/>
<stop class="end" offset="100%"/>
</linearGradient>
<rect x="0" y="0" width="100" height="100" style="fill:url(#gradient)" />
<circle cx="50" cy="50" r="30" style="fill:url(#gradient)" />
</svg>
</body>
</html>

rect and circle are not svg:rect and svg:circle, there is no need for that, they’re “inside” their respective namespace. Likewise when you don’t prefix every html element with html:. I’ve told you this before.

Unless you add disparate elements from the html in noon, or vice versa, <schön> is just fine. :slight_smile:

That’s a valid implementation for a simple single element embedded into a doc. However, if you were going to use multiple SVG elements interspersed throughout your XHTML doc, or complex interlacing of elements (not with SVG, but say, RSS), it would be likewise suggested or required to have a global namespace for all of your embedded elements rather than a local namespace for each element. Also, using a namespace prefix (even on a local declaration) is suggested for human-readability (it visually identifies the disparate documents better).

Namespace prefixes are only a must when there is a danger of confusion. <schön> is still just fine.

Depends on the spec and how it integrates with the XHTML. Here’s an example of interlaced XML that would require two namespaces declared (preferably both in the root element). Although SVG doesn’t work this way, this is not uncommon with other XML specs (e.g. RSS, XSL, SOAP, etc.).


<html xmlns="w3c://xhtml-NS" xmlns:noon="noon://schon-NS">

...
<noon:schon>
<table>
    <tbody>
        <tr>
            <td>
                <noon:schonElement>Whatever</noon:schonElement>
            </td>
        </tr>
        <tr>
            <td>
                <noon:schonAlternate>Whatever</noon:schonAlternate>
            </td>
        </tr>
    </tbody>
</table>
</noon:schon>

Since <schön> is not in danger of being confused with another element from another namespace, in this particular case, because XHTML doesn’t have a <schön> element, the noon: prefix is not necessary.

<schön> is just fine. Still. :slight_smile:

I hope you do finally realize you didn’t prefixed table: <html:table>, and what that says.

noon, I had to log in one last time to explain this last bit to you… the reason <table> doesn’t require a prefix in my example is because it’s in the default namespace (look at the xmlns declarations in the root <html> element). The only way to implement my example without a prefix on <schon> elements is to redeclare the namespace for each element, e.g.:


<html xmlns="w3c://xhtml-NS">
 
...
<schon xmlns="noon://schon-NS">
<table>
    <tbody>
        <tr>
            <td>
                <schonElement xmlns="noon://schon-NS">Whatever</schonElement>
            </td>
        </tr>
        <tr>
            <td>
                <schonAlternate xmlns="noon://schon-NS">Whatever</schonAlternate>
            </td>
        </tr>
    </tbody>
</table>
</schon>

As you can likely see, using a prefix is the more efficient method of doing this, especially if/when you get dozens of element references interspersed in a single document.

Now, it’s time for me to move on from SitePoint per Matt’s request… best of luck to you.

I agree with you that defining a default namespace for an element saves us from using prefixes in all the child elements.

However, what you fail to understand is that, the use of namespace prefix is only necessary if there is a danger of confusion, i.e. two elements from two different namespaces have the same name.

This is called “solving the name conflict using a prefix”.

My comment about <html:table> was to make you recognize the predominant HTML nature in X(HT)ML. :wink: