-
-
Notifications
You must be signed in to change notification settings - Fork 918
Closed
Description
The Problem
JRuby includes redundant xmlns:*
attributes on child notes, even when the parent node already has the namespace. MRI correctly omits redundant xmlns:*
attributes on child nodes.
Who cares?
I'm working to migrate RubySaml to purely use Nokogiri. While technically this is not a major functional issue, it is making my life difficult with test assertions about the structure of the XML.
Show me
Here's a simple script which illustrates the problem:
require 'nokogiri'
Nokogiri::XML::Builder.new do |xml|
xml['ds'].Signature('xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#') do
xml['ds'].SignedInfo do
end
end
end.doc.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
# MRI
# "<?xml version=\"1.0\"?>\n<ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"><ds:SignedInfo/></ds:Signature>\n"
# JRuby
# "<?xml version=\"1.0\"?>\n<ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"><ds:SignedInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"/></ds:Signature>"
DragonStuff