Skip to main content

GetXml

Returns the XML string of the current node.

Syntax

expression.GetXml();

expression - A variable that represents a ApiCustomXmlNode class.

Parameters

This method doesn't have any parameters.

Returns

string

Example

This example shows how to get the XML content of a custom XML node.

let doc = Api.GetDocument();
let xmlManager = doc.GetCustomXmlParts();
let xmlText = `
<?xml version="1.0" encoding="UTF-8"?>
<zoo>
<animal species="Lion" id="101">
<name>Leo</name>
<age>5</age>
<habitat>Savanna</habitat>
<diet>Carnivore</diet>
</animal>
</zoo>`;
let xml = xmlManager.Add(xmlText);
let node = xml.GetNodes('/zoo')[0];
let paragraph = Api.CreateParagraph();
paragraph.AddText("XML Content: " + node.GetXml());
doc.Push(paragraph);