76. setProperty
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 76. setProperty

Parameter syntax:

    [ '[document]'|'[implicitElement]'|'[implicitNode]' ]?
    [ '[remove]' ]?
    [ '[rebuildView]' ]?
    property_name [ property_value ]?

This command may be used to get, set or remove the property of a node. It is useful for writing macro-commands.

The default subject of this command is the explicitly selected node. Option `[document]` allows to select the document being edited. Option `[implicitElement]` allows to select the element containing the caret. Option `[implicitNode]` allows to select the text, comment or processing-instruction node containing the caret.

`property_name` specifies the qualified name of the property. Namespace prefixes (except "`xml`" which is always predefined) are not supported here. The syntax of a property name is:

    property_name = non_qualified_name | {namespace_URI}local_part

`property_value` specifies the new value of the property. When this value is not specified and option `[remove]` has not been specified, this command returns the current value of the property as a string. When this value is not specified and option `[remove]` has been specified, this command removes the property from the node.

Option `[rebuildView]` allows to rebuild the view of the node for which a property has been added, updated or removed. This is a convenient alternative to invoking command refresh.

Examples:

    setProperty myProp Hello world!
    setProperty myProp
    setProperty [remove] myProp

    setProperty [implicitElement][rebuildView] {http://www.acme.com/ns/xxe}p1 1024
    setProperty [implicitElement] {http://www.acme.com/ns/xxe}p1

Do not use this command to change the value of property `{http://www.xmlmind.com/xmleditor/namespace/property}readOnly`, instead use command setReadOnly.

Prev | Up | Next
75. selectTo | Home | 77. setReadOnly