Created
October 19, 2012 21:00
-
-
Save doxavore/3920696 to your computer and use it in GitHub Desktop.
Nokogiri 1.5.5: CRuby vs JRuby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<D:multistatus xmlns:D="DAV:"> | |
<D:response> | |
<D:href>some url one</D:href> | |
</D:response> | |
<D:response> | |
<D:href>some url two</D:href> | |
</D:response> | |
</D:multistatus> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<D:multistatus xmlns:D="DAV:"> | |
<D:response> | |
<href>some url one</href> | |
</D:response> | |
<response> | |
<href>some url two</href> | |
</response> | |
</D:multistatus> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
doc = Nokogiri::XML::Builder.new do |xml_base| | |
xml_base.send('multistatus', 'xmlns:D' => 'DAV:') do | |
xml_base.parent.namespace = xml_base.parent.namespace_definitions.first | |
xml = xml_base['D'] | |
xml.response do | |
xml.href "some url one" | |
end | |
xml.response do | |
xml.href "some url two" | |
end | |
end | |
end | |
puts doc.to_xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment