create

Usage

$doc := create nodename|expression

Aliases

new

Description

Returns a new document object. The argument must evaluate either to a valid element name (possibly followed by some attribute declarations) to be used for the document element, or to a well-formed XML string.

Unless switch-to-new-documents option is turned off, this command also changes current node to the new document.

$scratch/> $t1 := create root
$t1> ls $t1
<?xml version="1.0" encoding="utf-8"?>
<root/>

$t1> $t2 := create "root id='r1'"
$t2> ls $t2
<?xml version="1.0" encoding="utf-8"?>
<root id="r1"/>

$t2> create "<root id='r0'>Just a <b>test</b></root>"
/> ls /
<?xml version="1.0" encoding="utf-8"?>
<root id='r0'>Just a <b>test</b></root>

See Also

open, clone