![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - html tags within meta tags allowed? >Thread Next - Re: html tags within meta tags allowed? Re: html tags within meta tags allowed?To: NULL Date: 1/6/2005 3:07:00 AM On Wed, 05 Jan 2005 02:35:46 -0500, Donald Firesmith <donald_firesmith@h...> wrote: >Are html tags allowed within meta tags? Learn the difference between tags, elements and attributes. > Specifically, if I have html >tags within a <definition> tag within XML, can I use the definition as >the content within the <meta content="description> tag? Let's rephrase that as "Can I represent the content of one element as the content of an attribute of another element ?" In that case, then yes you can - with the proviso that you need to be careful about the meaning of "represent". The content models of elements and attributes are different, so you can't just "place" that of any element into an attribute, as it might contain the "<>" characters that mark out a tag (and are not permitted in attributes). But you can represent this, with a process known as entity encoding. The "awkward" characters <>&' are replaced with their entity encoded representations of < > & & ' Note that you have now done something "outside" of XML. XML does _not_ (and cannot) know what you've done, or that the contents of the destination element's attribute should be de-encoded on reading. It's a simple process to do, but it's not simple for the recipient to "know" that it ought to do this. there is _no_ way for "an XML tool" to recognise that it ought to - after all, the content is well-formed XML either way, it's just a question of interpreting its meaning. A common case where this is done is with RSS (although that's just put into another element, not an attribute) Because most of the RSS specs are so poorly written, there is great confusion here. http://diveintomark.org/archives/2004/02/04/incompatible-rss This is thus why in your literal example you _can't_ do what you're trying to do. Yes you could do it, but no you shouldn't. It is not "meaningful" (in the sense of understanding, not the sense of XML) to place encoded content, or anything resembling HTML or XML tags into the content attribute of a HTML <meta> element. The readers of it (of which there are very few) just aren't expecting to see it in there and they won't know what to do with it. They certainly won't have the action you're optimistically hoping for, sensible though that might have been (had we all know what the game was and how to play along). -- Smert' spamionam | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
