Guest User

Untitled

a guest
Jul 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. wrap: func [ n /end ] [ rejoin [ "<" either end ["/"][""] n ">" ] ]
  2.  
  3. block-to-xml: func [data] [
  4. accumulate [ n x ] a copy "" data [
  5. rejoin [ a wrap n either block? x [ block-to-xml x ] [ x ] wrap/end n ] ] ]
  6.  
  7. ; usage
  8.  
  9. >> block-to-xml [ 'inv [ title "10-0001" date "10-10-2010" client [ name "R ltd" city "NY" ] ] ]
  10. == {<inv><title>10-0001</title><date>10-10-2010</date><client><name>R ltd</name><city>NY</city></client></inv>}
Add Comment
Please, Sign In to add comment