What Was the <Xmp> Tag Used For

What was the XMP tag used for?

A quick Google search on W3C reveals that XMP was introduced for displaying preformatted text in HTML 3.2 and earlier. When W3C deprecated the XMP tag, it suggested using the PRE tag as a preferred alternative.

Update: http://www.w3.org/TR/REC-html32#xmp, http://www.w3.org/MarkUp/html-spec/html-spec_5.html#SEC5.5.2.1

XMP tag replaces my style with another

The xmp element causes by default the font to be set to a system-dependent monospace font. It may also cause the font size to be reduced somewhat. To prevent these, set

xmp { font-family: inherit; font-size: 100% }

A little safer way (due to lack of support to inherit in some old browsers) is to set the font face in the same context where you set it on the page as a whole or on the enclosing element. Example:

body, xmp { font-family: Cambria, Georgia; } 
xmp { font-size: 100% }

XMP metadata for how this was created?

There really isn't a specific tag along these lines that I can think of, so you can either re-purpose a tag or create your own tag.

One thing to take into account is how are you going to access the info in the sidecar files. OriginatingProgram is an ACDSee specific file and is unlikely to be read by most programs that would read sidecar files. Additionally, it sounds like it would likely be overwritten if ACDSee ever changed data in that sidecar file.

If you're setting up you're own system to read and processes sidecar files, then creating your own tag might be the way to go. Exiftool's example config file has info on doing so and more help can be found on the exiftool forums. But such a tag will probably not be visible to most software.

Re-purposing a more common tag that you might be a convenient strategy. If you have no plans on using a tag like Title or Description, then those are easy and well supported tags. Otherwise you could look to re-purpose a different tag that may not be relevant to the file, such as City, State or Country. Instructions might also be a good choice, as I believe it's intended purpose is for restrictions or right usages, which wouldn't really apply to a non-image or video file.

Personally, I tend to place miscellaneous info that is still important to the file in HierarchicalSubject. You can set it apart from other keywords in it's own hierarchy and it's still available and easy to see with most software.

HTML code in pre and xmp tags renders

I solved this problem. I made class="tag" somewhere in my css, and apperently google prettify use same class name (.tag) to mark the html tags, so after I changed the name of my class to another name, everything was ok.

How to work without xmp tag

Use xml/html data islands to store arbitrary data in your html. The following samples show some variations:

  1. xml data
  2. html data
  3. arbitrary text
  4. arbitrary text represented as a xml cdata section

The script tgas can be accessed from javascript and universal attributes like id may be added to simplify access.

<!-- xml -->
<script type="text/xml">
<data>
<!-- whatever -->
</data>
</script>

<!-- html -->
<script type="text/html">
<a href="http://example.com">example.com</a>
</script>

<!-- plain text -->
<script type="text/plain">
whatever
</script>

<!-- plain text in an xml cdata section (text mustn't contain ']]>') -->
<script type="text/xml">
<plain><![CDATA[...whatever...]]></plain>
</script>

There is an article on MDN discussing the technique.

There used to be the option to place xml tags in html documents. This is no longer supported by IE as of IE10.

Show source code without XMP tag

The most often used alternative is to use the <pre> or <code> element and escape characters that have a special meaning in HTML. < would become <, > is escaped to >.

According to Can I escape html tags within a class (recreate the xmp tag)?, you can still use the XMP tag. Browsers should still support it, although according to What was the <XMP> tag used for?, <pre> is the preferred element to use.



Related Topics



Leave a reply



Submit