{"id":1835,"date":"2011-03-27T12:51:00","date_gmt":"2011-03-27T12:51:00","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/Hayek\/Jochen\/wp\/blog-en\/2011\/03\/27\/rubyforge-xmlsimple-with-my-experiences-as-updates\/"},"modified":"2011-03-27T12:51:00","modified_gmt":"2011-03-27T12:51:00","slug":"rubyforge-xmlsimple-with-my-experiences-as-updates","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2011\/03\/27\/rubyforge-xmlsimple-with-my-experiences-as-updates\/","title":{"rendered":"RubyForge: XML::Simple (with my experiences as updates)"},"content":{"rendered":"<p>\t\t\t\t<a href=\"https:\/\/rubyforge.org\/projects\/xml-simple\/\">RubyForge: XmlSimple: Project Info<\/a><\/p>\n<p>Rather short after discovering this module, I made use of it with my FRITZ!Box call monitor in order to read my <i>Google Contacts as XML<\/i>. With this approach, that was a rather easy piece of cake.<\/p>\n<p>Update 2011-03-29:<br \/>\nIf an element has not attributes, the (text) content of that element simply gets appended as string to the list at the hash field by the name of that element.<br \/>\nNow if the element has attributes, the (text) content goes together with the attributes to a hash list, that gets appended to that list instead. The (text) content actually goes into a hash field by the name of &#8220;<i>content<\/i>&#8220;.<br \/>\nExample:<\/p>\n<blockquote><p>\n<span>text -&gt; &#8220;e&#8221;=&gt;[ \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&#8220;text&#8221;]<\/span><span>text -&gt; &#8220;e&#8221;=&gt;[{&#8220;content&#8221;=&gt;&#8221;text&#8221;,&#8221;a&#8221;=&gt;&#8221;v&#8221;}]<\/span><\/p><\/blockquote>\n<p>My Ruby code operates like this:<\/p>\n<blockquote><p>\n<span>x.instance_of?(Hash) ? x[&#8216;content&#8217;] : x<\/span><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>RubyForge: XmlSimple: Project Info Rather short after discovering this module, I made use of it with my FRITZ!Box call monitor in order to read my Google Contacts as XML. With this approach, that was a rather easy piece of cake. Update 2011-03-29: If an element has not attributes, the (text) content of that element simply [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_share_on_mastodon":"0"},"categories":[666],"tags":[],"class_list":["post-1835","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-tB","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/1835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=1835"}],"version-history":[{"count":0,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/1835\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=1835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=1835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=1835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}