Hi everyone,
I am working on creating XML documents through XML datatype in business central, I have almost succeeded in doing so, I have created the required document but I am facing an issue in removing namespace from child element, for example
You can see the "xmlns" is repeated on every child element, if anyone has an idea how to remove the namespace from child please do share, I have tried few available functions but not worked for me.
var
xmldoc: XmlDocument;
xmlDec: XmlDeclaration;
node: XmlElement;
node1: XmlElement;
begin
xmldoc := XmlDocument.Create();
xmlDec := xmlDeclaration.Create('1.0', 'ISO-81', 'no');
xmlDoc.SetDeclaration(xmlDec);
node := XmlElement.Create('Header', 'http://www.somethinh.com');
node.Add(XmlAttribute.CreateNamespaceDeclaration('xsi', namespace1));
//Header
node1 := XmlElement.Create('Header');
node.add(node1);
//line
node1 := XmlElement.Create('Header');
node.add(node1);
xmldoc.Add(node);
end;
Here is the code for creating the document.