I have 12 errors, but some are just pure non existent. I'm using the smarty templating engine.
Doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Here's the error report, but the "duplicate specification of attribute "value"" simply isn't true according to my .tpl: jsfiddle of .tpl here
{textfield class="quetext" value="Epost*" onblur="if(this.value=='')
this.value='Epost*';"
onfocus="if(this.value=='Epost*') this.value='';"}
Also, does a textarea require the attribute "rows" and "cols"? I thought that was only for tables?
And I don't understand what the two errors at the end mean:
Line 586, Column 80: Attribute value redefined...
Please help!
Thanks :)
(Sorry if things chop and change, I'm working on the valdiation now, to tidy up as many errors as possible.)
the "duplicate specification of attribute "value"" simply isn't true according to my .tpl:
The validator is only looking at your output. You have the value attribute in there twice, no matter what you .tpl says.
Also, does a textarea require the attribute "rows" and "cols"?
Yes
I thought that was only for tables?
Tables don't have those attributes at all
Line 586, Column 80: Attribute value redefined...
You have, in essence: <foo value="something" value="something">
This is the same problem as before, except it is the error on the second one rather than the first.
Related
I have a document which has invalid HTML and XML. I need to parse it in such a way that whenever any invalid HTML or XML it encounters it should fix it rather than treating it as a normal string. Till now I have tried this technique
Nokogiri::HTML(document)
Nokogiri::XML(document)
Both are not working in together.
I also refer this link but it didn't help me much. Also, I thought for a hack like to replace invalid HTML and XML with regex but my data is too much big so can't apply that hack
I am calling Nokogiri::HTML(document) so it handling html very well. But the problem is it is skipping the Xml tag which I don't want. I need those tags to print on the browser
Some tags like
</SESSION_CONFIG VERSION=“bgh:3”
<METHODS BASEURL=http://abc.hgd.com /servlet/IAMSERVER/>
<ADD_USER URL=“addUser/>
Though I Know some of the tags are not legal but still I need to print on browser
you need to configure norecover so Nokogiri does NOT try to fix the issues:
badly_formed = <<-EOXML
</SESSION_CONFIG VERSION=“bgh:3”
<METHODS BASEURL=http://abc.hgd.com /servlet/IAMSERVER/>
<ADD_USER URL=“addUser/>
EOXML
bad_doc = Nokogiri::HTML(badly_formed) { |config| config.norecover }
puts bad_doc
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>VERSION=“bgh:3”
<methods baseurl="http://abc.hgd.com"></methods>
<add_user url="“addUser/">
</add_user></p></body></html>
I am getting several validation errors regarding a website using drupal, coming from this section of the page:
<html lang="en" dir="ltr"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:og="http://ogp.me/ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
xmlns:sioct="http://rdfs.org/sioc/types#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<head>
The following validation errors:
Line 11, Column 48: Attribute xmlns:content not allowed here.
Line 11, Column 48: Attribute xmlns:dc not allowed here
Line 11, Column 48: Attribute xmlns:foaf not allowed here.
Line 11, Column 48: Attribute xmlns:og not allowed here.
Line 11, Column 48: Attribute xmlns:rdfs not allowed here.
etc....
Anyone ever experience this with drupal or any other site?
From the symptoms, it seems that you are validating against HTML5, probably using <!DOCTYPE html>. The W3C validator validates against the rules of HTML serialization (HTML syntax), where attributes like xmlns:content are invalid. There is no namespace concept, so any : in an attribute name is just yet another character with no special meaning, and such names have not been defined.
Using http://validator.nu/ you can select, in the “Preset” dropdown, XML serialization of HTML5, known as XHTML5. Then you need to follow all XML rules as well as HTML5 rules, and you need to include the attribute xmlns="http://www.w3.org/1999/xhtml" in the <html> tag.
I am debugging a layout right now and have come across some strange errors. and I am serving the page up as DTD XHTML 1.0 Strict.
The error shows is like this
ID "OFFICENAME" already defined:
div class="office" id="officename"
ID "OFFICENAME" first defined here
span id="officename">
and
NET-enabling start-tag requires SHORTTAG YES
This error is showing in the break code
<br />
Please any one help me out of this and tell me the correct way of representing
id must be unique. You can't have two elements with the same ID. You should remove one of the ids or use class instead. You can have multiple classes on any given element, e.g.:
class="office officename"
In HTML/SGML meaning of / is different than in XHTML: <foo/bar/ is <foo>bar</foo> and <foo/> is <foo></foo>> (that's an archaic quirk supported only by W3C validator).
You're probably sending XHTML markup as HTML. Use text/html MIME type with HTML5 DOCTYPE instead (you'll get better compatiblity, better validation and /> talismans will be allowed).
<!DOCTYPE html>
You can't have multiple elements with the same id. Change the id on the span or the div to something else.
I have a list of items in an html table. On each row (tr) I'm proceeding like this:
<tr idAffaire="#suite.IdAffaire" idSuite="#suite.IdSuite" class="#suite.Username row droppable">
I used the attributes idAffaire and idSuite for retrieving some infos later. I know the official identification attribute is "id" but in my case I need 2 id. When I compile my code, VS is warning me about some things:
this name contains uppercase characters, which is not allowed.
attribute 'idaffaire' is not a valid attribute of element 'tr'
...
Is it possible to prevent these warnings? Is there a better way of doing?
Thank you.
Yes, in Tools > Options > Text Editor > HTML > Validation > [Untick] Show errors
Ideally, you could use 2 hidden input fields with the id="suite" and value="whatever" to allow you to pick these up in a valid way.
The problem is that you are writing invalid HTML. As you mentioned, id is a valid attribute but idAffaire or idSuite are not. I'm assuming from the fact that you get a warning about uppercase characters, you are using an XHTML doctype. A better way to do this would be to use an HTML5 doctype:
<!DOCTYPE html>
And use custom data attributes for your new attributes:
<tr data-affaire="#suite.IdAffaire" data-suite="#suite.IdSuite" class="#suite.Username row droppable">
I believe you should add name space extension of yours. Then define your newly introduced attributes.
What you are doing is termed as adding custom attributes to html elements, which have a very varying opinion among the experts.
Firstly , using capital in html attributes is not recommended, you can switch to small case.
Secondly , adding custom attributes in XHTML (which i suppose you are using) throws warning, where as this is perfectly valid in HTML5.
there are few option to deal with it -
use Jquery .data() api to store data with java script.
or
follow a specific convention while storing data making it easy to maintain and read.You can follow HTML5 syntax
<ul>
<li data-id='5' data-name='john'></li>
</ul>
I have a html document:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
In it I have tags such as
<br />
But Im reading that this tag is an XHTML element. Yet it still works why?
Original answer based on the question as written before a character was moved and completely changed it:
But Im reading that </br> is an XHTML element.
It isn't. Is is the end tag for an element.
<br /> would be a self closing tag (representing an entire element) in XHTML. In HTML 4 it means the same as <br>> (although most browsers don't respect that) and in HTML 5 the / is meaningless syntactic sugar to keep people used to XHTML happy.
In XHTML <br/> means the same as <br></br> (the latter is an error in HTML documents).
Yet it still works why?
Browsers perform enormous amounts of error correction to try to deal with the sort of bad markup that was prevalent in the late 90s.
They are not always consistent in how they recover from different errors (for example, I believe that some browsers will ignore that completely while others will treat it as a line break), so you should never depend on this behaviour.
Browsers failed to implement parsers that correctly handled HTML 4 and earlier.
They should have treated <br/> as "A br element followed by a greater than sign", but instead implemented it as "A br element with a / attribute, what's a / attribute? We'll drop it". This led to the feature being marked as something to avoid.
XHTML then exploited the bug for HTML-Compatible XHTML.
HTML 5 then redefined it as syntactic sugar so the XHTML junkies could keep on using the syntax they were used to.
It's the browser that get rid of these differences. Anyways the </br> with that slash is incorrect both in HTML and XHTML.
Occurring to http://www.w3schools.com/tags/tag_br.asp
In HTML the <br> tag has no end tag.
In XHTML the <br> tag must be properly
closed, like this: <br />.
Self closing tag is valid format in XML
XHTML means all tag must be closed
HTML
<br> valid
<br/> valid
XHTML
<br> invalid
<br/> valid
Edited:
</br> is invalid anyway and you are lucky if browser fix it :)
</br> is the same as <div id="gd"/>, both are invalid