[uf-discuss] Automatic conversion of XML to microformat and vice
versa; recommendation for handling XML attributes?
Costello, Roger L.
costello at mitre.org
Sun Aug 27 06:31:37 PDT 2006
Microformat newbie here, so please bear with me if my questions are
That said, from the reading I have done on microformats, I am really
excited about it!
I am converting an XML document to a microformat. I want to design the
microformat in a fashion such that I will be able to convert the
microformat back to the original XML. I want the micrformat to retain
all the semantics of the XML, plus have a nice visual presentation,
microformat = XML semantics + appealing visual presentation
Leaf nodes in the XML document I map to an XHTML <dl> element, e.g.,
I map to this microformat:
Some things to note:
1. The XML tag is mapped to the value of the <dl> class attribute.
2. The microformat contains both the tag semantics and provides as a
nice visual presentation.
3. Using the approach exemplified here, any XML leaf node can be
automatically converted into the microformat form, and vice versa.
Do you agree with using <dl> for XML leaf nodes? If not, do you
recommend something else?
I am having problems with mapping XML leaf nodes that have attributes,
I am not sure how to map this into a microformat. Here is one
<dd>12000 <span class="units">meters</span></dd>
With this approach the microformat has retained all the semantics of
the original XML - both the semantics of the XML tag, as well as the
semantics of the XML attribute. Conversion from XML to microformat,
and from microformat to XML is easily accomplished.
What do you think of this approach of using <span> to capture
Let's make the problem still harder. Suppose the XML tag has two
AGL = Above Ground Level, i.e., the aircraft is at an altitude of 12000
meters above ground.
Proceeding in the same fashion, the microformat would be:
<dd>12000 <span class="units">meters</span>
What do you think of using multiple <span>s, one for each
Now, switching examples, consider this XML leaf node:
<commentary xml:space ="preserve">This is a
Continuing in the same fashion as above, this XML leaf node would map
to this microformat:
<dd>This is a commentary <span
However, for this XML leaf node I don't want the attribute value to
have a visual presence. I must confess, I am out of ideas on how to
handle this. Do you have a recommendation?
More information about the microformats-discuss