Fixes #44: Two prefixes resolving to the same namespace

Maxime “pep” Buquet created

The new TreeBuilder addition seems to have fixed this bug. I added the
test that was provided in !108 by Oliver Inemar but not the rest of the
code.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>

Change summary

minidom/src/element.rs | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

Detailed changes

minidom/src/element.rs 🔗

@@ -989,4 +989,20 @@ mod tests {
 
         assert_eq!(elem, elem2);
     }
+
+    #[test]
+    fn failure_with_duplicate_namespace() {
+        let elem: Element = r###"<?xml version="1.0" encoding="UTF-8"?>
+            <wsdl:definitions
+                    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+                    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+                <wsdl:types>
+                    <xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+                    </xsd:schema>
+                </wsdl:types>
+            </wsdl:definitions>
+        "###
+        .parse()
+        .unwrap();
+    }
 }