Reputation: 11
I have a field value in peoplesoft which contains a long description. The description has lot of HTML tags. from those I only want to remove the img tags (//). How can I do it through peoplecode? And where to write the peoplecode. Thanks in advance
Upvotes: 0
Views: 90
Reputation: 525
It would help to have a little more information:
Making assumptions here, but if the HTML is well formed, you can load it into an XMLDoc, and strip the img nodes.
&arrImgNodes = &inXMLDoc.GetElementsByTagName("img");
For each node in the the array, you can get the parent node and then remove the child.
xmlNode &pNode = &arrImgNodes[1].ParentNode;
&pNode.RemoveChild(&arrImgNodes[1]);
Then re-export your XML to a string:
&strHTML = &inXMLDoc.GenXmlString();
or &strHTML = &inXMLDoc.GenFormattedXmlString();
If you're going to display the code to the user.
Upvotes: 1