4D v16.3DOM Find XML element |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
DOM Find XML element
DOM Find XML element
The DOM Find XML element command looks for specific XML elements in an XML structure. The search starts at the element designated by the elementRef parameter. The XML node to seek is set expressed in XPath notation using the xPath parameter (see the “Use of XPath notation” parameter in the Overview of XML DOM Commands section). Indexed elements can be used. Note: In conformity with the XML standard, searches will be case sensitive. The command returns the XML reference of the element found. When the arrElementRefs string array is passed, the command fills it with the list of XML references found. In this case, the command returns the first element of the arrElementRefs array as the result. This parameter is useful when several elements with the same name exist at the location specified by the xPath parameter. This example lets you quickly look for an XML element and display its value: vFound:=DOM Find XML element(vElemRef;"Items/Book[15]/Title") The same search can also be done as follows: vFound:=DOM Find XML element(vElemRef;"Items/Book[15]") Note: As you can see in the above example, the XPath path must always begin with the name of the current element. This detail is important when you are handling relative XPath paths. Given the following XML structure: <Root> <Elem1> <Elem2>aaa</Elem2> <Elem2>bbb</Elem2> <Elem2>ccc</Elem2> </Elem1> </Root> The following code can be used to retrieve the reference of each Elem2 element in the arrAfound array: ARRAY TEXT(arrAfound;0) 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. An error is generated when:
See also
|
PROPERTIES
Product: 4D HISTORY
Modified: 4D v11 SQL ARTICLE USAGE
4D Language Reference ( 4D v16) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||