oozcitak/xmlbuilder-js — Issue #17: Root element will not accept attributes
Author: bradfordcp
Created: 2011-12-03 01:11:32+00:00
State: open

I'm trying to add attributes to the root element but they do not appear when I call toString(). The only item that is returned is the element itself...

For Example:

````javascript
var xmlbuilder = require('xmlbuilder');

// Create the builder instance
var stream_doc = xmlbuilder.create();

// Start the stream element
stream_doc.begin('stream:stream', {version: '1.0'});

// Add the appropriate attributes
stream_doc.att('from', 'foo@example.com');
stream_doc.att('to', 'example.com');
stream_doc.att('xml:lang', 'en');
stream_doc.att('version', '1.0');
stream_doc.att('xmlns', 'jabber:client');
stream_doc.att('xmlns:stream', 'http://etherx.jabber.org/streams');
````

Will return:

````xml

````

Instead of:

````xml

````