InsertCommentBefore (XmlNode function)
Insert a Comment before this node (XmlNode class)
[Requires Janus SOAP]
[%outNod =] nod:InsertCommentBefore( value)
|%outNod||If specified, an XmlNode that is set to point to the Comment node that is added.|
|nod||XmlNode pointing to the (non-Root) node before which the Comment node is inserted.|
|value||A Unicode string that is the value of the added Comment node; stored exactly as is, that is, without whitespace normalization.|
- Since the return value of InsertCommentBefore is frequently not needed, you may want to Call it instead of saving its return value.
- As of Sirius Mods Version 7.3, value may include only non-null EBCDIC characters that translate to Unicode. As of Sirius Mods Version 7.6, all Janus SOAP string arguments and results are Unicode or are converted to Unicode. For more information about the effects of this Version 7.6 change, see "Strings and Unicode with the XmlDoc API".
- There is a very small "one-time" processing cost if certain Xpath expression operations are performed after using this method, because "Insert-Before" methods are guaranteed to add a node out of document order. In general, processing an XmlDoc is likely to be more efficient if you add nodes in document order (that is, top-to-bottom, left-to-right).
- To modify the value stored in a Comment node, change the Value property of an XmlNode that points to the Comment node.
In the following example, a Comment node is inserted before node "a":
begin %doc is object xmlDoc %doc = new Call %doc:loadXml('<top><a><b>05</b></a></top>') %n1 is object xmlNode %n1 = %doc:selectSingleNode('top/a') call %n1:insertCommentBefore('legacy code follows') call %doc:Print end
The example results follow:
<top> <a> <b>05</b> </a> </top>
This list is not exhaustive: it does not include all the errors that are request cancelling.
- The nod argument is the Root node.
- The value argument violates the rules for an XML comment.
- AddComment also adds a Comment node. InsertCommentBefore adds a Comment as the immediately preceding sibling of the node pointed to by the method object; AddComment adds the Comment as the last child of the node pointed to by the method object.
- For hints about inserting a node after a sibling node, see the InsertElementBefore examples.