Define root node with a namespace?

24 views
Skip to first unread message

viatropos

unread,
Sep 30, 2009, 4:17:02 AM9/30/09
to nokogiri-talk
How do I add a namespace to the root node using the Builder? The
following is currently impossible:

doc = Nokogiri::XML::Builder.new { |xml|
xml['my_ns'].root('xmlns:my_ns' => "http://example.com"){
...
}
}.doc

I would like to be able to create something like this:

<my_ns:root xmlns:my_ns="http://example.com">
...
</my_ns:root>

Is this implemented in some other way?
Reply all
Reply to author
Forward
0 new messages