GetXml
返回当前节点的 XML 字符串。
语法
expression.GetXml();
expression - 表示 ApiCustomXmlNode 类的变量。
参数
此方法没有任何参数。
返回值
string
示例
读取文档中存储的特定节点的 XML 标记。
// How do I extract the raw XML content of a node embedded in a document?
// Inspect or export a node's full markup when working with structured data in a document.
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);