anchor.diff:        var expected = '<element />';
         expect(actual, expected);
       });
  +    test('invalid namespace optimized', () {
  +      var builder = new XmlBuilder(optimizeNamespaces: true);
  +      builder.element('element', nest: () {
  +        expect(() => builder.namespace('http://1.foo.com/', 'xml'),
  +            throwsArgumentError);
  +        expect(() => builder.namespace('http://2.foo.com/', 'xmlns'),
  +            throwsArgumentError);
  +      });
  +      var actual = builder.build().toString();
  +      var expected = '<element />';
  +      expect(actual, expected);
  +    });
       test('conflicting namespace', () {
  -      var builder = new XmlBuilder();
  +      var builder = new XmlBuilder(optimizeNamespaces: false);
         builder.element('element', nest: () {
           builder.namespace('http://1.foo.com/', 'foo');
           expect(() => builder.namespace('http://2.foo.com/', 'foo'),
  
positive.code:     });
      test('namespace binding', () {
        var uri = 'http://www.w3.org/2001/XMLSchema';
        var builder = new XmlBuilder();
        builder.element('schema', nest: () {
          builder.namespace(uri, 'xsd');
          builder.attribute('lang', 'en', namespace: uri);
  
negative.code:       assertTreeInvariants(xml);
        var actual = xml.toString();
        var expected =
        '<schema xmlns="http://www.w3.org/2001/XMLSchema" lang="en">'
        '<element />'
        '</schema>';
        expect(actual, expected);
      });
      test('default namespace binding optimized', () {
        var uri = 'http://www.w3.org/2001/XMLSchema';
        var builder = new XmlBuilder(optimizeNamespaces: true);
        builder.element('schema', nest: () {
          builder.namespace(uri);
          builder.attribute('lang', 'en', namespace: uri);
          builder.element('element', namespace: uri);
        }, namespace: uri);
        var xml = builder.build();
        assertTreeInvariants(xml);
        var actual = xml.toString();
        var expected =
        '<schema xmlns="http://www.w3.org/2001/XMLSchema" lang="en">'
        '<element />'
        '</schema>';
        expect(actual, expected);
      });
      test('undefined namespace', () {
        var builder = new XmlBuilder(optimizeNamespaces: false);
        expect(() => builder.element('element', namespace: 'http://1.foo.com/'),
            throwsArgumentError);
      });
      test('undefined namespace optimized', () {
        var builder = new XmlBuilder(optimizeNamespaces: true);
        expect(() => builder.element('element', namespace: 'http://1.foo.com/'),
            throwsArgumentError);
      });
      test('invalid namespace', () {
        var builder = new XmlBuilder(optimizeNamespaces: false);
        builder.element('element', nest: () {
          expect(() => builder.namespace('http://1.foo.com/', 'xml'),
              throwsArgumentError);
  