Syntax
XML_Node *XML_FindNodeByPath(
XML_HANDLE hXml,
const char *nodePath,
int *ErrCode
);
Parameters
- hXml
- [in] XML handle
- nodePath
- [in] A pointer to a string that specifies the full path.
- ErrCode
- [out] A pointer to a variable that returns an error code. Specify NULL when no error code is required.
Return value
Returns a pointer to the XML_Node structure if the function succeeds, otherwise NULL.Remarks
Finds nodes according to the specified full path.
If a node is found, returns a pointer to the XML_Node structure of the node.
If multiple nodes are found, returns a pointer to the XML_Node structure of the first node found and returns following error code in ErrCode.
| Error code | Description |
|---|---|
| XML_NOT_UNIQUE_NODE | Multiple nodes with the same name were found. |
Example: multiple nodes with the specified name
If you specify "ship_order/orders/order" as the full path, it returns a pointer to the XML_Node structure of the first "order" node and returns XML_NOT_UNIQUE_NODE in ErrCode.
<request_message> ← Root node
<issuer>SALES0001</issuer>
<ship_order>
<date>2021/09/10</date>
<customer>
<customerID>C00001</customerID>
<name>A corporation</name>
</customer>
<orders>
<order> ← Search result (XML_NOT_UNIQUE_NODE)
<productID>PID0000100</productID>
<name>A product</name>
</order>
<order> ← Another node that matches the specified name
<productID>PID0000200</productID>
<name>B product</name>
</order>
</orders>
</ship_order>
</request_message>
If the function fails, it returns NULL and ErrCode returns the following error code:
| Error code | Description |
|---|---|
| XML_INVALID_PARAMETER_ERROR | Parameter error |
| XML_MEMORY_ALLOCATION_ERROR | Memory allocation error |
| XML_INVALID_XML_OBJECT_ERROR | Invalid XML handle |
| XML_INVALID_NODE_OBJECT_ERROR | Invalid node is specified. |
| XML_NOT_FOUND | The node with the specified name was not found. |
| XML_NOT_UNIQUE_INTERMEDIATE_NODE | Multiple nodes with the specified name were found in the middle of the node path. |
Requirements
Header file:
XML.hLibrary file:
CodeConversion.h : ver. 1.1.1 or later.
libXML.a
libCodeConversion.a : ver.1.1.1 or later
libSTARTUPOPH5000.a
See also
Last updated: 2021/10/21