JSMA dom

Overview

What can JSMA dom do for me?

The JSMA dom allows you to read and write the header field in requests and responses.

Index

Methods

The JSMA dom provides the following methods:

dom.create(tag_name)

Returns a JSMA nodeCollection.

Example

//create container root node
var container = dom.parse("<container></container>", false).find("container");

  
//create item and add to container
var item = container.create("item");
item.attr("name", "Test");
item.text("Ein Testinhalt");
container.append(item);
  
//return string result
return container.stringify(true, 2);

Parameter tag_name (required)

dom.parse(input, [strict])

Parses the given input as HTML. Use parameter 'strict' to raise parsing errors if present.

Example

//create container root node
var container = dom.parse("<container></container>", false).find("container");


//create item and add to container
var item = container.create("item");
item.attr("name", "Test");
item.text("Ein Testinhalt");
container.append(item);

//return string result
return container.stringify(true, 2);

Parameter input (required)

Parameter strict (optional)

dom.parseXML(input)

# TODO Description schreiben

Example

...
dom.parseXML(input)
...

Parameter input (required)

Parameter strict (optional)

dom.stringify(document, [pretty], [indentationStep])

Returns a JSMA dom as string result

Example

//create container root node
var container = dom.parse("<container></container>", false).find("container");


//create item and add to container
var item = container.create("item");
item.attr("name", "Test");
item.text("Ein Testinhalt");
container.append(item);

//return string result
return container.stringify(true, 2);

Parameter document (required)

Parameter pretty (optional)

Parameter indentationStep (optional)