Remove warning in MyEclipse - html

How can I modify the conditions for which MyEclipse will throw up warning flags? I'd be happy to hear a generic solution, but here is my specific problem for the curious/if it turns out to be relevant:
<html xmlns="http://www.w3.org/1999/xhtml">
<wicket:panel>
<p>
<object type="text/html" width="750" height="360" wicket:id="htmlRendition"></object>
</wicket:panel>
</html>
causes warnings "Undefined attribute name (xmlns)," "Unknown tag (wicket:panel)" and "Undefined attribute name (wicket:id)." Oddly, there are no errors for most HTML files paired with Wicket Java files, only files with the format ClassName$InnerClassName.html.

I use the following in my HTML files for Wicket:
<!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:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
I know some IDEs (IntelliJ) for example allow you to register a dtd to validate your xml files. This article looks to apply to XML documents, but perhaps HTML files work or can be configured to work similarly:
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.wst.xmleditor.doc.user/topics/cxmlcat.html

In the project properties, you can turn off different types of validation. For example, you can say that you don't want DTD validation of XML files, or HTML validation, etc.
Myeclipse example is here.

Related

How to replace with   in an html file

I want to replace all the with   in my html file to support XML parser.
But I don't want to replace them directly, I'd like to add an entity in <!DOCTYPE > like below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[<!ENTITY nbsp " ">]>
<html><head></head><body><div>Hello World!</div></body></html>
But when I view the file, there is an extra ]> on the top of the document:
Anyone know how to deal with it?
Thanks!
What you have is a valid way to include an entity declaration in an internal subset. The document is not otherwise valid, though, as you can check with the W3C Markup Validator: the required xmlns attribute on the html element is missing, and so is the required title attribute.
When served as text/html, the document is processed how browsers use to process HTML document, which means among other thing that internal subsets are not recognized; in fact, document type definitions are not read at all – instead, doctype declarations are just taken as magic strings so that some strings trigger “quirks mode”, some don’t. The doctype declaration is parsed in a simplistic manner, which makes the first “>” terminate it, so whatever comes after it is taken as character data.
The morale is that entity declarations just don’t work with “HTML”, internally or externally, when “HTML” means sending something to a browser and telling (in HTTP headers) it to be text/html – and that’s what servers normally tell when they send .html files.
Served as application/xhtml+xml and fixed to conform to XHTML syntax, your approach works on conforming browsers (online demo: http://www.cs.tut.fi/~jkorpela/test/nbsp.xhtml):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
[<!ENTITY nbsp " ">]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Entity demo</title></head>
<body>
<div>Hello World!</div>
</body>
</html>
However, IE 8 and earlier don’t process HTML when served as application/xhtml+xml (the browser just launches a “Save As” dialog).
The conclusions depend on what you are doing and why (and in which sense) you need to “support XML parser”. It’s not really about parsing but about entity declarations. XHTML user agents are not required to understand predefined entities as in HTML (except for those defined in XML), but has this possibility realized somehow? And in general, it is better to convert to actual no-break space characters than to character references.
here
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[<!ENTITY nbsp " ">

Modyfing code completion in PhpStorm 5

After entering first characters of <textarea> tag and using autocomplete ( e.g. <texta and hitting ENTER) editor generates following snippet: <textarea rows="" cols=""
It's extremely unhelpful since I don't use rows and cols attributes.
How can I modify those snippets ?
I tried "Live templates" section but it's not there.
In this case code completion is performed according to the DTD, which defines rows and cols attributes of the textarea tag as Required.
Most likely your file starts with:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
or the default HTML language level defines it.
To address this problem you can create HTML 5 files with <!DOCTYPE html> and PhpStorm will stop completing these attributes.
See also the related IDE setting:

syntax error for xhtml doctype in header

Firebug is reporting a syntax error for the following:
<!DOCTYPE html PUBLIC "-//W3C XHTML 1.0 Transitional//EN" "DTD/xhtml1- transitional.dtd">
I don't understand why since it has worked fine for the past 2 months!
You are trying to load an HTML document as JavaScript, either because you are sourcing a 404 document or because you've forgotten to add the URI and thus created a relative URI back to the current document (<script src=""></script>).
When interpreted as JS, the Doctype is a syntax error.

autocomplete attribute is not passing XHTML 1.0 Transitional validation, why?

I'm trying to cleanup my xhtml validation -- I'm running my pages through the W3C validator. For some puzzling reason it's not passing on input fields with the autocomplete="off" attribute:
<input name="kwsearch" id="sli_search_1" type="text" autocomplete="off" onfocus="if(this.defaultValue==this.value) this.value='';"
onblur="if(this.value=='')this.value=this.defaultValue;" class="searchbox" value="Search" />
I'm using this doctype:
<!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" xml:lang="en" lang="en">
And this is the validation error:
Line 410, Column 81: there is no attribute "autocomplete"
…li_search_1" type="text" autocomplete="off" onfocus="if(this.defaultValue==thi…
I thought this was okay with the W3C -- but, maybe it's still in "submission" phase?
http://www.w3.org/Submission/web-forms2/#autocomplete
Thoughts?
The Web forms specification has nothing to do with HTML 4 / XHTML. Sadly, autocomplete will not pass validation.
I think the only way to achieve valid HTML 4 /XHTML with autocomplete turned off is adding the attribute on page load using JavaScript. Sucks, I know - but I think it's the only way.
autocomplete is a HTML5 attribute, so use a HTML5 document type declaration, if you need it.
That W3C link is for the web forms stuff, not core XHTML. It might be possible to pull in the extra DTD for the web forms and get the page to validate.
If you need autocomplete( browsers do support it ), then try extending your doctype, like in this XHTML 1.1 below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
<!ATTLIST form autocomplete (on|off) #IMPLIED>
]>
I've just banged up against this irritating conflict between browsers and standards. I ended up getting around it by running javascript ON THE PAGE, not waiting for window.onLoad or $(document).ready(), to add the attribute to all elements with the class no-browser-autocomplete. Then i went through my app removing autocomplete="off" and adding this class instead.
Obviously this will fail in browser environments not running javascript.
The reason that i do it on the page, rather than in a dom ready block, is that if you wait for dom ready, the browser's already autocompleted it, at least in Firefox (which i'm testing it in).
So, this is at the start of one of the javascript files i include in my app layout:
//this needs to run BEFORE all of the loaded/ready events fire, that's why it's not in the dom.ready function
$(".no-browser-autocomplete").attr("autocomplete", "off");
$(function(){
//dom ready
});

Can i make an XSLT transformation directly in html page?

I know namespace are used to describe, like doctype, but is there a way or a trick to transform inner namespace html with an xsl using xsd ?
<?xml version="1.0" encoding="UTF-8"?>
<!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:sample="sample-uri">
<head >
<title>Enter the title of your XHTML document here</title>
</head>
<body >
<p sample:node="retrieve-transformation">Enter the body text of your XHTML document here</p>
</html>
In other words i want to know if i can process xsl transformation to an xhtml page whithout using javascript.
In XHTML (i.e. application/xhtml+xml—not text/html!), you can trigger an XSLT program without JavaScript using the xml-stylesheet processing instruction.
Modern browsers support XSLT out of the box.
Take a look at eu.wowarmory.com - they use it extensively. If the server detects a user agent that does not support XSLT, it is rendered at the server side, and a quite verbose HTML is rendered there and sent to the browser.
This makes a nice abstraction if you plan to provide an XML webservice similar to the web site.
No, you cannot perform an XSL transformation without using some kind of scripting technology. I would suggest you do it serverside to save the client the trouble; and to avoid various issues if the transformation for some reason does not succeed on the client or runs slow.