cmd:forkey is specifically for "include this tag/twig" for this/these tag(s). If you want to process all (or all except a few) you'd use cmd:foreachkey.

OTOH, I do assume the list of keys, or at least the list of keys to be handled differently, is known. Like in one of the examples, the {PageId} key is to become the value of the id="" attribute of the <page> tag and all others will end up in the <field> tags.

I assume both the structure of the data and the structure of the XML is known. This is not, "hey, here's some data, serialize it anyhow so that when you deserialize it again, I end up with the same data". It's rather "hey. I have the data in this structure and need to write them to XML in that structure so that they will accept it".


In reply to Re^6: Datastructures to XML by Jenda
in thread Datastructures to XML by Jenda

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.