GetNode method: Incoming Business Interlink class
Syntax
GetNode({nodename | nodenumber})
Description
The GetNode method returns a BiDocs reference to a child XML node (element or comment). Use the GetNode method upon a BiDocs reference to an XML element to access the child nodes for that element.
Parameters
| Parameter | Description |
|---|---|
|
nodenumber | nodename |
Specify the node that you want to reference. You can specify either a node number (the first node is 1, the second 2, and so on) or a node name (that is, the XML tag.) |
Returns
BiDocs. The returned XML element within a BiDocs object.
Example
Here is a set of XML request code.
<?xml version="1.0"?>
<postreq>
<email>joe_blow@example.com</email> <projtitle>
<projsubtitle>first_subtitle</projsubtitle>
<projsubtitle>second_subtitle</projsubtitle> <projsubtitle>third_subtitle</projsubtitle>
</projtitle>
</postreq>
Here is the PeopleCode that gets the postreqDoc element and the projtitle element.
Local BIDocs &rootInDoc, &postreqDoc, &projtitleDoc;
Local string &name, &blob;
&blob = %Request.GetContentBody();
&rootInDoc = GetBiDoc(&blob);
&postreqDoc = &rootInDoc.GetNode("postreq");
&projtitleDoc = &postreqDoc.GetNode("projtitle");
Here is the PeopleCode that gets the postreqDoc element, the projtitle element, and the third projsubtitle element.
Local BIDocs &rootInDoc, &postreqDoc, &projtitleDoc, &projsubtitleDoc;
Local string &name, &blob;
&blob = %Request.GetContentBody();
&rootInDoc = GetBiDoc(&blob);
&postreqDoc = &rootInDoc.GetNode(1);
&projtitleDoc = &postreqDoc.GetNode(2);
&projsubtitleDoc = &projtitleDoc.GetNode(3);
To parse a list of elements like <projsubtitle>, where elements have the same name, you must call GetNode using an index number rather than the element name.