Why do I get a warning from xml:lang attribute? - xhtml-1.0-strict

Aptana gives me a warning saying "<html> has XML attribute xml:lang"
Here is the line. What's wrong here?
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

your code is fine, it's the bug of the built-in HTMLTidy validator
I've found the answer here:
https://aptanastudio.tenderapp.com/discussions/problems/3034-templates

What doctype have you used?
You should choose any xhtml valid doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
or
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
There is another one used for framesets...

Make sure you are using an XHTML doctype, such as
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
or
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
It could also be a problem with Aptana not properly recognizing the xml:lang attribute, but it is more likely that you are not using the correct DOCTYPE.

Related

Using class attribute instead of styleClass of a JSF component actually works, why?

As far as I understood, we needed to use styleClass= as the JSF components don't support using just class=.
I've noticed recently that some components that were using class= were still rendering correctly. As a minimal example,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>Simple JSF Facelets page</title>
</h:head>
<h:body>
<h:inputText class="wut" anothertag="hi" value="me"/>
</h:body>
</html>
This produces
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link type="text/css" rel="stylesheet" href="/individuallifefaz/javax.faces.resource/theme.css.xhtml?ln=primefaces-aristo"/>
<title>Simple JSF Facelets page</title></head>
<body>
<input type="text" name="j_idt5" value="me" class="wut"/>
</body>
</html>
Why is this working? It's clearly not just passing through any unknown tags, as the anothertag is stripped out.
This is actually done by the view technology Facelets, not by the JSF component itself. Facelets has an alias for class attribute which automatically maps to styleClass. This was implemented as part of support for jsfc attribute as used in "designer friendly Facelets" which should make things like this possible:
<input type="text" jsfc="h:inputText" class="foo" />
If you use JSF with a different view technology (although so far there's none which is a serious alternative to Facelets, and JSP is deprecated), then there's no guarantee that <h:inputText class> would work.
See also:
Is there a way to run a JSF page without building the whole project?

Open Graph tags in XHTML - "property" not known

after several hours of researching I really need your help.
I simply want to define the preview picture, when I post the website-url on facebook. I already added these meta properties to my website:
<meta property="og:image" content="image.png" />
<meta property="og:title" content="My Website" />
This is my Doctype Specification:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
However, the attribute "property" does not exist. Yes, this is not new to xhtml. So I looked in older threads and extended the Doctype with RDFa, so now it looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0">
But this still doesn't work!
When I use the Open Graph Object Debugger from Facebook, it says:
"Based on the raw tags, we constructed the following Open Graph properties", and it shows many random images which are included in my website, but none of them are usable as preview picture.
I am really desperate and would greatly appreciate your help!
Edit: Can anybody help please :P

Doctype changing

In the sourcecode, I have the doctype as <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
But in the browser, while viewing sourcecode('View SourceCode' option), I am finding doctype as <!DOCTYPE html>. Why is it so? Any problems with this?
Those DOCTYPEs are definitely different, and in some browsers will trigger different behaviour. However, it's impossible for that to change on the fly. Are you absolutely sure that the changes you make to that document are being reflected on what you see in the website?
Firefox and Chrome always show <!DOCTYPE html> in the inspector and the page source no matter what doctype you set.
* This browser bug has been patched.

Character Output - PHP Includes

Here the problem - my html doc type heading is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
If I write some text which includes the '£' sign it displays correctly.
If I include a php script which uses the '£' sign I get strange character output:
�
I know that I can replace the £ with the html characters code '£' but since my site is large that is not practical.
Any suggestions?
Thanks!
Can't you use the utf8_encode function?

facebook doctype, is it being deprecated?

I've recently started working on a facebook app and I am lost and confused trying to get any direct answer. Googling for answers don't seem to work too well with facebook as things are changing too fast and blogs rarely update it to reflect the new APIs.
I know Facebook will deprecate FBML and I am overjoyed by that.
So my question is, will the DOCTYPE facebook gave you to put on your site, being deprecated?
What does doing this even do?
Assuming you are talking about this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
(specifically the xmlns:fb="http://www.facebook.com/2008/fbml"). They are not deprecating that. You should continue to add xmlns:fb="http://www.facebook.com/2008/fbml" in your <html> tag. However, for modernity you should be using the HTML5 doctype, so your doctype and HTML tag should look like this:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
What the xmlns:fb part does is specifies the XML namespace for tags within the page which begin with the fb: prefix (such as <fb:name/>).