Error validating HTML through w3c validator - w3c-validation

I am trying to validate my site through the w3c validator, but am getting the following error:
Line 62, Column 393: & did not start a character reference. (& probably should have been escaped as &.)
…mysite.com/projects/bnd?page=catagory&id=10">asdas</a> (67)</li><li><a href="
I have fixed all other things, but using & in a URL is not a valid w3c URI. How then could I validate my site?

Use & like this:
<a href="http://mysite.com/projects/bnd?page=catagory&id=10">

search and replace the & at line 62 with&

Related

find xpath of label with non breaking space

I am trying to get xpath for following html code, but nothing seems to be working. I appreciate your suggestion. I need to get the xpath based on text.
<label class="label" securityidpath="ACCOUNTS_FS.PART_ACCOUNT_HEADER_FS.PART_ACCOUNT_STATUS" title="Part Account Status">Part Account Status:
</label>
FYI, I tried following variant xpath
//label[normalize-space(text())='Part Account Status:\u00a0']
//label[normalize-space(text())='Part Account Status:\u000a']
//label[normalize-space(text())='Part Account Status:\u202f']
and all the options as per following url https://en.wikipedia.org/wiki/Whitespace_character
Thank You,
Yougander
You can use
/label[normalize-space(text())='Part Account Status: ']
Or use the hexadecimal variant   instead of the decimal  .
Also note that XPath uses slashes (and not backslashes) to define paths, so referencing the root node label would be done by /label.
The typo lable instead of label is trivial.
BTW you can avoid the trouble with the entity by using the title attribute in your XPath:
label[normalize-space(#title)='Part Account Status']
your element name is wrong and change UTF character name as HexaDecimal entity values:
//label[normalize-space(text())='Part Account Status: ']
XPATH require forward slash

Thymeleaf parsing error due to link with &

My link:
<a data-pin-do="buttonPin" data-pin-color="white" data-pin-
count="beside" href="https://www.pinterest.com/pin/create/button/?
url=https%3A%2F%2Fwww.flickr.com%2Fphotos%2Fkentbrew%2F6851755809%2F
&media=https%3A%2F%2Ffarm8.staticflickr.com%2F7027%2F6851755809_df5b2051c9_z.jpg
&description=Next%20stop%3A%20Pinterest">
<img src="https://assets.pinterest.com/images/pidgets/pinit_fg_en_rect_white_20.png" />
</a>
Currently thymeleaf thinks that the & in the url should be followed by an ';' character.
Exception message:
org.xml.sax.SAXParseException: The reference to entity "media" must end with the ';' delimiter.
Is there any way to get rid of the & signs and still have a functional url? Or is there any way to tell thyemleaf to 'overlook' the & signs in the url?
Instead of & you should use the entity & to encode your url like:
href="www.myurl.com?param1=value&param2=value"
Or build it using Link URL Expression #{...} with parameters:
th:href="#{www.myurl.com(param1=${'value1'},param2=${'value2'})}"
It's not only a Thymeleaf matter. You can find a detailed explanation here: Do I really need to encode & as &?)

Howto embed a custom non-visible HTML5 data attribute in a Freemarker template?

I would like to define a custom data-* attribute in an Spring form tag:
<#form.input path="endDate" data-tralaaa="moin"/>
Unfortunately Freemarker doesn't like this. Anyone a clue? I get the following exception:
Caused by: freemarker.core.ParseException: Encountered "-" at line 24, column 114 in WEB-INF/views/reisenachsendung/period.ftl.
Was expecting:
"=" ...
I would like to produce a HTML5 valid page. So dataTralaaa is not an option.
Update: As of 2.3.22, you can use - (and . and :) as part of any name if you precede it with a \, like in <#form.input data\-tralaaa="moin">. (It's not too cute, but - is already used as subtraction operator, and fixing this wouldn't backward compatible, and so must wait for a major FTL version increase.)
The problem is that you can't use dash in parameter names. This is a syntactical restriction. But that's maybe only half of the problem. Does Spring's #form.input accept parameters that it doesn't know and inserts them into the HTML tag? Because if it doesn't, then the whole dash issue doesn't mater.

Uncaught SoapFault exception: [Sender] Invalid XML with Magento API

"Uncaught SoapFault exception: [Sender] Invalid XML" outputs when I try to import bulk products into Magento.
I have a excel file, a product per line, I have about 178 products. Everything is ok until it goes to the 22 line. The Fatal Error outputs.
Anyone knows what's happened. Thank you very much!
You may have used some special characters (like "<" (left chevron) or ">" (right chevron) or "'" (single quote)), in the product existing in line #22.
You need to make sure that the special characters are converted / used by the corresponding HTML entities only in such scenarios, directly in the excel file only.
If you don't convert / delete those special characters in the excel file only, then in the API they get used up as the characters to be used for the API. This is a little bit similar to the way how SQL Injection occurs.
Hope it helps.

illegal character in jsonp response

Hi i am doing an exercise where I am trying to scrape content of nytimes website using javascript/ajax.
In order to send cross domain ajax request I am using a proxy server that returns me jsonp response with nytimes website content.
But since that html content has some charaters (single quotes) which throws "Illegal Character" error.
<script type="text/javascript" src="http://json-proxy.jgate.de/?callback=callback&url=http%3A%2F%2Fwww.nytimes.com%2F"></script>
<script>
function callback(obj) {
alert(obj);
}
</script>
What could be a possible solution to this error?
And what are other alternatives to solve this?
Thanks
(p.s. This question was asked to one my friends in his interview)
Update: Here is yahoo pipes link for the same.
http://pipes.yahoo.com/pipes/pipe.run?_id=748e37c218ed0747d0b868ae8eafefa6&_render=json
You have to escape the characters on the server.
callback('<!DOCTYPE html PUBLIC \"-//W...etc.') // notice the \"-//W
Instead of:
callback('<!DOCTYPE html PUBLIC "-//W...etc.') // which will eventually create an error
Escape all the special characters like /, \, ", ' to /, \ ...
Yahoo pipes fixed that issue.

Resources