<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ohnishiakira</author_name>
  <author_url>https://blog.hatena.ne.jp/ohnishiakira/</author_url>
  <blog_title>おおにしあきらの日記</blog_title>
  <blog_url>https://ohnishiakira.hatenadiary.org/</blog_url>
  <categories>
    <anon>ruby</anon>
    <anon>nokogiri</anon>
  </categories>
  <description>環境 Mac OS X 10.7.5 Ruby 1.9.3-p327 Nokogiri 1.5.6 問題 XMLノードに子要素を追加する際にNokogiri::XML::Node#add_childを使いつつ引数を文字列で渡すと、要素名が小文字になる。要素名はdowncaseしないでほしい。 解決 Nokogiri::XML::DocumentFragment#newを使う。長ったらしくてめんどくさいし、もっといい方法がある気がするんだけど見つけられていない。 ソースコード #!/usr/bin/env ruby # coding: utf-8 require &quot;nokogiri&quot; doc =…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fohnishiakira.hatenadiary.org%2Fentry%2F20130108%2F1357650952&quot; title=&quot;NokogiriでXMLに子要素を追加すると要素名が小文字になる - おおにしあきらの日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2013-01-08 22:15:52</published>
  <title>NokogiriでXMLに子要素を追加すると要素名が小文字になる</title>
  <type>rich</type>
  <url>https://ohnishiakira.hatenadiary.org/entry/20130108/1357650952</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
