xmlbuilder
Advanced tools
Changelog
[8.1.0] - 2016-03-29
begin
export function. When used with a callback function, the XML document will be generated in chunks and each chunk will be passed to the supplied function. In this mode, begin
uses a different code path and the builder should use much less memory since the entire XML tree is not kept. There are a few drawbacks though. For example, traversing the document tree or adding attributes to a node after it is written is not possible. It is also not possible to remove nodes or attributes.var result = '';
builder.begin(function(chunk) { result += chunk; })
.dec()
.ele('root')
.ele('xmlbuilder').up()
.end();
Object.assign
with lodash.assign
to support old JS engines. See #111.Changelog
[8.0.0] - 2016-03-25
begin
export function. See the wiki for details.commentBefore
, commentAfter
, instructionBefore
and instructionAfter
functions for this purpose.Changelog
[7.0.0] - 2016-03-21
Processing instructions are now created as regular nodes. This is a major breaking change if you are using processing instructions. Previously processing instructions were inserted before their parent node. After this change processing instructions are appended to the children of the parent node. Note that it is not currently possible to insert processing instructions before or after the root element.
root.ele('node').ins('pi');
// pre-v7
<?pi?><node/>
// v7
<node><?pi?></node>
Changelog
[6.0.0] - 2016-03-20
XMLStringWriter
class which can be accessed by the stringWriter(options)
function exported by the module. An XMLStreamWriter
is also added which outputs the XML document to a writable stream. A stream writer can be created by calling the streamWriter(stream, options)
function exported by the module. Both classes are heavily customizable and the details are added to the wiki. It is also possible to write an XML writer from scratch and use it when calling end()
on the XML document.