# Class: XmlWriter

## jala.XmlWriter(header)

This class defines a generic interface to write arbitrary and validating XML source code. This is done by first applying data objects onto template objects, both in a specified format. Then, the resulting object tree is transformed into XML. Moreover, template objects can be extended with other template objects to provide full flexibility in inheriting subclasses.

## Constructor

#### new XmlWriter(header)

Construct a new XML writer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`header` | String | An optional XML header.

Source:
  - jala/code/XmlWriter.js, line 49

##### Returns:

A new XML writer.

### Methods

#### addNamespace(name, url)

Add a namespace to this writer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | The name of the namespace.
`url` | String | The URL string of the namespace.

Source:
  - jala/code/XmlWriter.js, line 313

##### Returns:

The XML root element.

#### clone(The)

Clone this XML writer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`The` | Object | clone templare.

Source:
  - jala/code/XmlWriter.js, line 349

##### Returns:

The cloned XML writer.

#### createElement(data)

Get a newly created XML element.

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | Object | The XML data as object tree.

Source:
  - jala/code/XmlWriter.js, line 276

##### Returns:

The resulting XML element.

#### extend(template, ext)

Extend a template object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`template` | Object | The template object.
`ext` | Object | The extension object.

Source:
  - jala/code/XmlWriter.js, line 296

##### Returns:

The XML writer.

#### getRoot()

Get the root XML element of this writer.

Source:
  - jala/code/XmlWriter.js, line 285

##### Returns:

The root XML element.

#### toString()

Get the XML output as string.

Source:
  - jala/code/XmlWriter.js, line 337

##### Returns:

The XML output.

#### write()

Write the XML to the response buffer.

Source:
  - jala/code/XmlWriter.js, line 325