E-IB/PC : InsertNode method of XMLDoc class not producing correct XML output (Doc ID 2090211.1)

Last updated on JANUARY 09, 2017

Applies to:

PeopleSoft Enterprise PT PeopleTools - Version 8.54 and later
Information in this document applies to any platform.

Symptoms

ENVIROMENT
----------------------
Tools 8.54.11
Development environment

ISSUE
-----------
Trying to use InsertNode Function of XML Node class. The function is not behaving as per Peoplebooks in 8.54. The sample peoplecode provide in PeopleBooks is incorrect

Local XmlDoc &inXMLDoc, &firstDoc;
Local XmlNode &childNode, &secondNode;

&firstDoc = CreateXmlDoc("<?xml version='1.0'><myroot><third><child/></third></myroot>");
&inXMLDoc = CreateXmlDoc("<?xml version='1.0'><root><first/><second/></root>");
&childNode = &firstDoc.DocumentElement.FindNode("/third");
&secondNode = &inXMLDoc.DocumentElement.FindNode("/second");

&inXMLDoc.DocumentElement.InsertNode(&childNode, &secondNode);

Above code is pasted as it is from Peoplebooks. Peoplebooks says the output from &inXMLDoc should be:

The following is the XML document before the insert:

<?xml version="1.0"?>
<root>
<first/>
<second/>
</root

The following is the XML document after the insert:

<?xml version="1.0"?>
<root>
<first/>
<third>
<child/>
</third>
<second/>
</root>

The sample code is not producing the correct results AFTER the insert

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms