Schema itemprop attributes are marked as invalid, how to fix it? - w3c-validation

In my current WordPress theme, I have implemented Microdata (using Schema.org) for every possible element. But after I have run markup validation on validator.w3.org, it's showing 21 errors on only itemprop attributes.
The errors are:
Validation Output: 21 Errors
Error Line 76, Column 131: The itemprop attribute was specified, but the element is not a property of any item.
…op="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog">
✉
Error Line 78, Column 225: The itemprop attribute was specified, but the element is not a property of any item.
…scope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
✉
Error Line 81, Column 44: The itemprop attribute was specified, but the element is not a property of any item.
…lass="entry-title" itemprop="headline"><a href="http://www.bloggingspell.com/a…
✉
Error Line 86, Column 42: The itemprop attribute was specified, but the element is not a property of any item.
<div class="entry-thumb" itemprop="image">
✉
Error Line 91, Column 43: The itemprop attribute was specified, but the element is not a property of any item.
<div class="entry-summary" itemprop="text">
✉
Error Line 100, Column 213: The itemprop attribute was specified, but the element is not a property of any item.
…scope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
✉
Error Line 103, Column 44: The itemprop attribute was specified, but the element is not a property of any item.
…lass="entry-title" itemprop="headline"><a href="http://www.bloggingspell.com/a…
✉
Error Line 108, Column 42: The itemprop attribute was specified, but the element is not a property of any item.
<div class="entry-thumb" itemprop="image">
✉
Error Line 113, Column 43: The itemprop attribute was specified, but the element is not a property of any item.
<div class="entry-summary" itemprop="text">
✉
Error Line 122, Column 224: The itemprop attribute was specified, but the element is not a property of any item.
…scope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
✉
Error Line 125, Column 44: The itemprop attribute was specified, but the element is not a property of any item.
…lass="entry-title" itemprop="headline"><a href="http://www.bloggingspell.com/m…
✉
Error Line 130, Column 42: The itemprop attribute was specified, but the element is not a property of any item.
<div class="entry-thumb" itemprop="image">
✉
Error Line 135, Column 43: The itemprop attribute was specified, but the element is not a property of any item.
<div class="entry-summary" itemprop="text">
✉
Error Line 144, Column 229: The itemprop attribute was specified, but the element is not a property of any item.
…scope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
✉
Error Line 147, Column 44: The itemprop attribute was specified, but the element is not a property of any item.
…lass="entry-title" itemprop="headline"><a href="http://www.bloggingspell.com/s…
✉
Error Line 152, Column 42: The itemprop attribute was specified, but the element is not a property of any item.
<div class="entry-thumb" itemprop="image">
✉
Error Line 157, Column 43: The itemprop attribute was specified, but the element is not a property of any item.
<div class="entry-summary" itemprop="text">
✉
Error Line 166, Column 230: The itemprop attribute was specified, but the element is not a property of any item.
…scope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
✉
Error Line 169, Column 44: The itemprop attribute was specified, but the element is not a property of any item.
…lass="entry-title" itemprop="headline"><a href="http://www.bloggingspell.com/a…
✉
Error Line 174, Column 42: The itemprop attribute was specified, but the element is not a property of any item.
<div class="entry-thumb" itemprop="image">
✉
Error Line 179, Column 43: The itemprop attribute was specified, but the element is not a property of any item.
<div class="entry-summary" itemprop="text">
I have implemented the Microdata by following the sites yoast.com and bloggingwizard.com. These two are showing valid on W3C validator but my site is not. Can anybody help me with this issue?
Here is the URL of validation check:
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.bloggingspell.com%2F&charset=%28detect+automatically%29&doctype=Inline&group=0
And here is my site:
http://www.bloggingspell.com/
My theme: Crangasi

You have an itemprop on your main element, but there is no parent item to which this property belongs to.
As you are using mainContentOfPage, you probably want to have a WebPage item. But note that this property can’t have Blog as value, it needs to be a WebPageElement.
So you might want to remove itemprop="mainContentOfPage" from main.

Related

XPath: extract attribute value plus inner text of child element

Is it possible to use an XPath expression to extract both the value of an attribute and the value of the inner text of a child element? For example, I want to obtain the value 6 and the six values 100, 200, 300, 400, 500, 600 from the following XML:
<Main>
<Example dim="6">
<Example-i>100,200,300,400,500,600</Example-i>
</Example>
</Main>
I can see how to get the value of the dim= attribute (e.g. //Example/#dim), and the inner text of the <Example-i> element (e.g., //Example-i/text()), but I cannot figure out a unified XPath expression to extract both.
You can use the fn:concat(...) function like this
concat(/Main/Example/#dim,' - ',/Main/Example/Example-i)
Or, in a more generalzied way
concat(//Example/#dim,' - ',//Example/Example-i)
Its output, in both cases, is
6 - 100,200,300,400,500,600

Invalid prop: type check failed yet the code works as I was expecting

Inside of a grid layout I was attempting to set two column sizes dynamically depending on a boolean flag like this <v-col v-if="this.displayMeeting" cols="4"> and below setting the second column like this <v-col :cols="[displayMeeting ? '8' : '12']">
When the page displays, I get this in the console
[Vue warn]: Invalid prop: type check failed for prop "cols". Expected Boolean, String, Number, got Array
but the page layout works. If the meeting window is present, I get two cols one class="col col-4" and the other class="col col-8". If I falsy set the boolean flag the one column goes away and the second column jumps from 8 to 12.
So it works, but with two warnings in console?
You are providing an array and its expecting Boolean, Number or String so replace it with String by removing the square bracket wrapping.
<v-col :cols="displayMeeting ? '8' : '12'">
<!--- here --^^-------------------------^^---->

xpath expression to select attribute value

Is there an xpath way to select a given attribute value?
For example I have an html document and want to select only "?ms=669601" :
<input type="button" value="تفاصيل" onclick="xmlreqGET("?ms=669601","jm1x");">
In your simple example, you could simply select that portion of the onclick attribute in the only input:
substring(input/#onclick, 12, 10)
In more complicated documents, try selecting first by #value (or some other (possibly unique) criteria):
substring(//input[#value='تفاصيل']/#onclick, 12, 10)
Or by targeting the input that contains part of the desired substring:
substring(//input[contains(#onclick, 'xmlreqGET(')]/#onclick, 12, 10)
Selecting the input element itself if its onclick attribute contains the target string:
//input[contains(#onclick, '?ms=669601')]
Note: Your input is not valid XML, due to nested double-quotes.

XPath query to select all href attributes of <a> tag, which 'class' attribute equals specified string

I don't know why following query doesn't work:
//a/#href[#class='specified_string']
Try it the other way round:
//a[#class='specified_string']/#href
After all, class is an attribute of the <a> element, not an attribute of the href attribute.
An attribute cannot have attributes. Only elements can have attributes.
The original XPath expression:
//a/#href[#class='specified_string']
selects any href attribute of any a element, such that the href attribute has an attribute class whose value is 'specified_string'.
What you want is:
//a[#class='specified_string']/#href
that is: the href attribute of any a element that has class atribute with value 'specified_string'.
You basically say that you are looking for an attribute named href, whose attribute (this is the error) class should be equal to specified_string.
But you need to find the attribute href of an element a, whose attribute class is specified_string.
(ndim's answer overlapped mine)
There is not class attribute present in anchor tag I have href only. It is identified using //*[#href='value'] but //*a[#href='value'] is not working

what does this xpath expression mean?

//input[#type="hidden" and #name="val" and position() = 1]/#value
does this mean get the text typed inside the input box ?
Read from right to left, it means "Get the value attribute of all of the input tags whose type attribute is 'hidden', whose name attribute is 'val', and which appears as the first element in its enclosing (form) tag".
I think it means grab the value attribute of an input whose type attribute is 'hidden' in addition its name attribute is 'val' and its position amongst its siblings is 1 ( first I believe, not sure if 0 is the start in xpath ).
<input type="hidden" name="val" value="test">
<input type="hidden" name="foo">

Resources