DeleteAttribute
Deletes an attribute from the XML node at the specified XPath.
Syntax
expression.DeleteAttribute(xPath, name);
expression
- A variable that represents a ApiCustomXmlPart class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
xPath | Required | string | The XPath of the node from which to delete the attribute. | |
name | Required | string | The name of the attribute to delete. |
Returns
boolean
Example
This example demonstrates how to delete attribute from custom XML part.
- Code
- Result
let doc = Api.GetDocument();
let xmlManager = doc.GetCustomXmlParts();
let xml = xmlManager.Add("<content xmlns='http://example' version='1.0'></content>");
let deletionSuccess = xml.DeleteAttribute('/content', 'version');
let infoParagraph = Api.CreateParagraph();
infoParagraph.AddText("Xml string representation: " + xml.GetXml());
doc.Push(infoParagraph);