4D v13.4DOM SET XML ELEMENT VALUE |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
DOM SET XML ELEMENT VALUE
DOM SET XML ELEMENT VALUE
The DOM SET XML ELEMENT VALUE command modifies the value of the element set by elementRef. If you pass the optional xPath parameter, you choose to use XPath notation to indicate the element to be modified (for more information about this notation, refer to the section Use of XPath notation (DOM)). In this case, you must pass the reference of a root XML element in elementRef and the XPath path of the element to be modified in xPath . In elementValue, pass a string or a variable (or a field) containing the new value of the specified element:
When the optional asterisk (*) parameter is passed, this indicates that the value of the element must be set in the form of CDATA. The special CDATA form can be used to write raw text as is (see example 2). Note: If the element designated by elementRef is a BLOB processed by this command, it is automatically encoded in base64. In this case, the DOM GET XML ELEMENT VALUE command does automatically the reverse operation. In the following XML source: <Book> <Title>The Best Seller</Title> </Book> If the following code is executed, with vElemRef containing the reference to the “Title” element: DOM SET XML ELEMENT VALUE(vElemRef;"The Loser") We get: <Book> <Title>The Loser</Title> </Book> In the following XML source: <Maths> <Postulate>1+2=3</Postulate> </Maths> We want to write the text “12<18” in the <Postulate> element. This string cannot be written as is in XML because the “<” character is not accepted. This character must therefore be changed into “<” or the CDATA form must be used. If vElemRef indicates the XML <Postulate> node: ` Normal form We get: <Maths> <Postulate>12 < 18</Postulate> </Maths> ` CDATA form We get: <Maths> <Postulate><![CDATA[12 < 18]]></Postulate> </Maths> If the command has been executed correctly, the system variable OK is set to 1. Otherwise, it is set to 0 and an error is generated (for example, if the element reference is invalid). |
PROPERTIES
Product: 4D
INDEX HISTORY
Modified: 4D 2004.4 SEE ALSO
DOM GET XML ELEMENT VALUE |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||