Custom Microdata and Custom Schema.org - html

My site gives satellite frequency info.Like this;
Frequency: 11881
Polarization: V
Symbol Rate: 27500
Fec: 3/4
I want to use microdata for this datas.
i used PageMap like this;
<PageMap>
<DataObject type="action">
<Attribute name="channel_name" value="Watan TV"/>
<Attribute name="frequency" value="11012"/>
<Attribute name="polarization" value="H"/>
<Attribute name="symbol_rate" value="27500"/>
<Attribute name="fec" value="5/6"/>
</DataObject>
</PageMap>
And i want to use microdata. But i cant find any type in Schema.org. So i used like this:
<div itemscope>
<span itemprop="channel_name">Watan TV</span>
<span itemprop="frequency">11012</span>
<span itemprop="polarization">H</span>
<span itemprop="symbol_rate">27500</span>
<span itemprop="fec">5/6</span>
</div>
Is this wrong? Or which schema type must i choose? Thanks...

For Microdata, you can either
find a suitable vocabulary, or
create your own vocabulary, or
use only proprietary properties.
The last case is what you use in your example. Because you don’t specify the itemtype attribute, you are not using a vocabulary. You can come up with any name (as long as it doesn’t contain . or :), but don’t expect consumers to re-use your data: because you are not using a vocabulary, you are the only one who knows what all the properties really mean.
If your goal is providing the data for search engines, you’ll probably want to use Schema.org, as this is currently the only vocabulary which the big search engine services support (they are its sponsors). But if Schema.org doesn’t provide a suitable type, you can’t use it (you could use a broad type that applies, e.g., everything is a Thing, but it’ll miss all the properties you need for your case). Your only option here is to suggest an extension for Schema.org (but even it they implement it, it of course doesn’t mean that search engines start doing something with this data).

Related

What's the difference between `<seg>` and `<span>`

What's the difference between a <seg> in XML and <span> in HTML? Here are two passages from Bibles, one from the English Bible in Christodouloupoulos' and Steedman's massively parallel Bible corpus,
<?xml version="1.0" ?>
<cesDoc version="4">
…
<text>
<body id="Bible" lang="en">
<div id="b.GEN" type="book">
<div id="b.GEN.1" type="chapter">
<seg id="b.GEN.1.1" type="verse">
In the beginning God created the heaven and the earth.
</seg>
<seg id="b.GEN.1.2" type="verse">
And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.
</seg>
…
and the other from the NIV English Bible at Bible Gateway, which is where they got most of their texts from:
<p class="chapter-1">
<span id="en-NIV-27932" class="text Rom-1-1">
<span class="chapternum">1 </span>
Paul, a servant of Christ Jesus, called to be an apostle and set apart for the gospel of God—
</span>
<span id="en-NIV-27933" class="text Rom-1-2">
<sup class="versenum">2 </sup>the gospel he promised beforehand through his prophets in the Holy Scriptures
</span>
…
In the HTML, a it seems a <span> can replace a <seg>, except that the HTML has added verse numbers in <span>. Oh, and the chapters are in <div>. So it's not one-to-one.
Of course, I realize that HTML and XML are different, and this is only one juxtaposition; I'm sure there are others out there. But I'm going to need to be able to display XML as HTML, and I don't want to anger the doctype gods. So, conceptually, how is <seg> different from <span> in purpose, meaning and usage?
Update: #jim-garrison, says I'm going to need to read the schema to understand the XML, but I'm a neophyte at that, too. In particular, I did find some official-looking documentation for <seg> by TEI that makes me think it's use is a little more than arbitrary, but I have no idea how to interpret this documentation. Should it give us a more specific answer than what Jim has already written?
The difference between XML and HTML generally is that the list of tags that can be present in XML is defined by a DTD or XML Schema, and tags represent document semantics and not presentation. So tags can be named anything. In HTML the set of tags is generally predefined, as if there was a pre-existing HTML DTD or schema, but HTML is not XML and doesn't follow all the rules of XML. While HTML was in some sense derived from the same parent as XML (SGML), and the two are superficially very similar, they are most definitely NOT the same thing.
The answer to your specific question is that the writers of the XML chose to use a tag named <seg> ("segment"?) to represent generalized strings of text, with attributes providing additional semantic information. For more details you'll need to find the DTD or XML schema that governs the content of the XML and read the documentation that goes with it.
But I'm going to need to be able to display XML as HTML, and I don't want to anger the doctype gods. So, conceptually, how does different from in purpose, meaning and usage?
This is where you will use XSLT to transform the input XML into valid HTML. To figure out how to do that transformation you will need to know the full semantics of all the tags that can appear (again, go to the documentation for the DTD/Schema) and decide on a visual representation for the data. There's no one answer to "how should a <seg>" be transformed. That's up to your requirements regarding presentation. One possible transformation converts <seg> tags to <span>, but that may depend on the value of certain attributes (type="verse" vs some other type). It might even differ depending on output medium (desktop vs tablet vs phone vs watch vs ...?)
Once you convert from XML to HTML you have left the realm of the Doctype gods and they have no interest in what you do :-) There's a whole different set of deities such as CSS-Cthulhu, Javascript-Janai'ngo (look it up), et al who will take great pleasure making your life miserable.

Can you use plain text for addresses in schema.org markup?

I have a CMS that has a single text field for an Organization address. The data is stored very inconsistently and, in many cases, I'm dealing with city/state only. I'm fairly new to schema.org and would like to know if I can simply do something like the following to handle the markup:
<p itemprop="address">Some city, WY</p>
As I said, I'm new to all this, but I guess I'm using the "Microdata" format.
Yes, you may use text as value for address. While its expected value is another item (namely PostalAddress) instead of text, Schema.org does not require this (bold emphasis mine):
While we would like all the markup we get to follow the schema, in practice, we expect a lot of data that does not. We expect schema.org properties to be used with new types. We also expect that often, where we expect a property value of type Person, Place, Organization or some other subClassOf Thing, we will get a text string. In the spirit of "some data is better than none", we will accept this markup and do the best we can.
However, it’s questionable if it’s really the "physical address" of an Organization if you only specify city and state.
If you would use a PostalAddress item as value, you could specify exactly what the address parts are that you provide, so consumers have a better chance to understand your data:
<p itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="addressLocality">Some city</span>,
<span itemprop="addressRegion">WY</span>
</p>
(Terminology: You are using the syntax, or format, Microdata and the vocabulary Schema.org.)
I'm afraid that wouldn't really work, as the expected value for the "address" property is the PostalAddress type. But you can simply do something like this as one possible option:
<span itemprop="location" itemscope itemtype="http://schema.org/City">
<span itemprop="name">City Name</span>, State
</span>
I wouldn't recommend that you use the PostalAddress type because technically the postal address should be the full mailing address.
David

dl - multiple definitions for the same term

Is it allowed to use definition list tag like this
<dl class="feature-list">
<dt>Stackoverflow</dt>
<dd>Is a nice place place to find some answers</dd>
<dt>Stackoverflow</dt>
<dd>Has a cool team</dd>
<dt>Stackoverflow</dt>
<dd>Welcomes your contribution</dd>
<dt>Stackoverflow</dt>
<dd>is simply amasing</dd>
</dl>
The idea is to have a product feature list, while every feature starts with the product name. But product name is the same for every feature. If that is not an allowed usage, what will be the most suitable layout for such a case?
Up to HTML 4.01, the dl element has been defined as a definition list, though with notes that make it questionable whether this was really meant. In HTML5 CR, the dl element is a description list, representing “an association list consisting of zero or more name-value groups”. So there is not much of semantics here, just an abstract structure. So more or less anything that matches the syntax can be said to be conforming, and the syntax has always permitted markup as in the question.
A list where each “value” (dt element) has the same content looks odd, but there is nothing formally wrong with it. Associating different “values” with the same “name”, even when the “name” is repeated, can be seen as a legitimate use of an association list.
Besides, there is no evidence of browsers or search engines assigning any particular structural meaning to dl, i.e. the real effect of using it is the default rendering you get with it. Thus, if such rendering is OK, and a suitable basis for the more detailed rendering you are aiming at, dl is suitable.

Which HTML tags are more appropriate for money?

If you had to properly choose one HTML tag to represent a price, a money amount or an account balance, (e.g. 3/9/2012 - Income: 1.200,00 € or item #314159 - price: $ 31,99) then
which tag would you choose for the amount and why?
should the currency also be wrapped in its own tag or not?
I'd really like to avoid a generic inline element like <span class="income">1.200,00 €</span> or <span class="price">$ 31,99</span> but so far I've found no references about it.
The HTML spec for var states:
The var element represents a variable. This could be an actual
variable in a mathematical expression or programming context, an
identifier representing a constant, a function parameter, or just be a
term used as a placeholder in prose.
For me this means that <var> is not suitable for the prices in your examples. It depends on what you are trying to accomplish, but it seems your options are:
Use microdata (ref), for example Schema.org’s offer vocabulary for a product’s price
Use <b> if you’d like to draw attention to the price without indicating it’s more important (ref)
Use <strong> if the price is important, such as the total price of an itemised receipt
Use <span> with a class if you need an element to style the price differently, but <b> and <strong> are not appropriate
If nothing above is suitable and you don’t want to style the price, don’t do anything
From the examples you’ve given there doesn’t seem to be any need to mark up prices. If the examples are from a table to display financial information, make sure they’re in a column headed by <th scope="col">Income</th> or <th scope="col">Price</th> respectively for accessibility.
Hope that helps!
Looking at the HTML5 specs, it's rather clear that a price is not considered to be a semantic entity. And I agree. Think about it this way:
If there were semantic elements, this would be the result
<p>
I have 4 apples, 2 oranges and <money>5 <currency>dollars</currency></money>.
</p>
What is it that makes 5 dollars different from 2 oranges? Should we add a <fruit> tag too?
which tag would you choose for the amount and why?
A span with a class, if you want to add some CSS.
Because nobody really cares too much about semantics. Nice to have, but in reality all that matters is styling.
The currency should be also wrapped in its own tag or not?
Definitely not.
I'd really like to avoid a generic inline element
Why?
You may decide to use <i> if you want to express the "special nature of money".
The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, ...
http://dev.w3.org/html5/spec/the-i-element.html
What about <data>?
<p>The price is <data class="money" value="100.00">$100</data>.</p>
According to the HTML5 spec:
The data element represents its contents, along with a machine-readable form of those contents in the value attribute.
When combined with microformats or microdata, the element serves to provide both a machine-readable value for the purposes of data processors, and a human-readable value for the purposes of rendering in a Web browser. In this case, the format to be used in the value attribute is determined by the microformats or microdata vocabulary in use.
In this case you could also use microdata to add additional information about the kind of currency, etc.
I would use a definition list here.
The HTML element (or HTML Description List Element) encloses a
list of pairs of terms and descriptions. Common uses for this element
are to implement a glossary or to display metadata (a list of
key-value pairs).
<dl>
<dt>Income:</dt>
<dd>1.200,00 €</dd>
<dt>Price:</dt>
<dd>$31,99</dd>
</dl>
I can't see anything more semantic than var either:
<var>1.200,00 <abbr title="EUR">€</abbr></var>
Use the var tag. Is described as: "Variable or user defined text"
<var> </var>

Label Tag semantics

I've read this and I GENERALLY use spans or strongs to describe "text-labels". Is this true for best practices? It seems is also a semantic way but why is it limited to just form elements?
What if I wanted to display information as this:
Name: FOo Bar
Age: 27
Weight: 151 kg
etc?
name, age, and weight can all be described as labels, but since the items they're describing aren't input tags, it isn't semantically correct(for html and w3c at least). I usually use
<span class="label"> or <span class="description"> or <span class="person-detail"> etc
but generally there should also be a tag for labels that don't pertain to input fields. As this might be a bit subjective I don't mind this turning into a community wiki or something
You should use a definition list (dl with dt and dd):
<dl>
<dt>Name</dt>
<dd>FOo Bar</dd>
<dt>Age</dt>
<dd>27</dd>
<dt>Weight</dt>
<dd>151 kg</dd>
</dl>
The spec states that it could be used for
terms and definitions, metadata topics and values, questions and answers, or any other groups of name-value data.
I think a table (with th) could be used, too. But I would only use it when I want to compare several people, not just listing the data of one person.
I'd avoid using a label tag unless it's in combination with a functional HTML form (with editable fields); otherwise, using it may be semantically confusing.
A span tag has no semantic meaning, regardless of the id or class added to it, and regardless of the context in which it's used. You don't gain anything semantically by using a span (though it does no harm).
A strong tag has a generic meaning (this content has extra importance) that doesn't vary based on the context in which it's used. It's sometimes useful when there's nothing else more appropriate.
In this particular case, a definition list (as suggested by #unor) seems like the way to go. If advanced styling is required, put each name-value pair into a separate definition list (which may be awkward semantically, but it allows greater flexibility with styling the content).
I guess if you wanted to be 100% semantically correct you'd have to use labels in conjunction with disabled or readonly text boxes that have been styled to look a bit different.