4D v16.3DOM Insert XML element |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
DOM Insert XML element
DOM Insert XML element
The DOM Insert XML element command can be used to insert a new XML element among the child elements of the XML element whose reference is passed in the targetElementRef parameter. Pass the element to be inserted in sourceElementRef. This element must be passed as the reference of an existing XML element in a DOM tree. The childIndex parameter can be used to designate the child of the parent element before which the new element must be inserted. Pass an index number in this parameter. If the value is not valid (for example, there is no child element having this index), the new element will be added before the first child of the parent element. The command returns the reference of the XML element obtained. In the following structure, we would like to invert the first and second book: <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <BookCatalog> <Book> <Title>Open Source Web Services</Title> <Author>Collective</Author> <Date>2003</Date> <ISBN>2-7440-1507-5</ISBN> <Publisher>Wrox</Publisher> </Book> <Book> <Title>Building XML Web services</Title> <Author>Scott Short</Author> <Date>2002</Date> <ISBN>2-10-006476-2</ISBN> <Publisher>Microsoft Press</Publisher> </Book> </BookCatalog> To do this, simply execute the following code: C_TEXT($rootRef)
See also
|
PROPERTIES
Product: 4D HISTORY
Created: 4D v12 ARTICLE USAGE
4D Language Reference ( 4D v16) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||