Criei um Documento XML, ao criar o 2o. Node 'Header' vem com o attribute do node anterior.
O Node é criado como <Header xmlns="">
como poderei remover o xmlns="" do Node
Usei o seguinte código
XML := NewXMLDocument;//initializate the interface
XML.Options := [doNodeAutoIndent];//activate the auto indentation
XML.Encoding:= 'Windows-1252'; //'ISO-8859-1';
XML := NewXMLDocument;
XML.Version := '1.0';
XML.Options := [doNodeAutoIndent,doAttrNull];
XML.Encoding := 'Windows-1252';
RootNode := XML.AddChild('AuditFile','');
RootNode.Attributes['xmlns:xsi'] := 'http://www.w3.org/2001/XMLSchema-instance';
RootNode.Attributes['xsi:schemaLocation'] := 'urn:OECD:StandardAuditFile-Tax:PT_1.04_01 .\SAFTPT1.04_01.xsd';
RootNode.Attributes['xmlns'] :='urn:OECD:StandardAuditFile-Tax:PT_1.04_01';
Node0 := RootNode.AddChild('Header');//add the task node
Node0.Resync;
addChildToNode(Node0, 'Version','1.04_01', 10, True);
addChildToNode(Node0, 'CompanyID' ,'11111111111111', 50, True);
addChildToNode(Node0, 'TaxRegistrationNumber' ,'222222222222222222222', 9, True);
addChildToNode(Node0, 'TaxAccountingBasis' ,'F', 1, True );
addChildToNode(Node0, 'CompanyName' ,'444444444444444444444',100, True ); //Nome Registado
addChildToNode(Node0, 'BusinessName' ,'5555555555555555555555555555', 60, False );
O resultado foi:
<?xml version="1.0" encoding="Windows-1252"?>
<AuditFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:OECD:StandardAuditFile-Tax:PT_1.04_01 .\SAFTPT1.04_01.xsd" xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.04_01">
`**`<Header xmlns="">`**
`<Version>1.04_01</Version>
<CompanyID>11111111111111</CompanyID>
<TaxRegistrationNumber>222222222</TaxRegistrationNumber>
<TaxAccountingBasis>F</TaxAccountingBasis>
<CompanyName>444444444444444444444</CompanyName>
<BusinessName>5555555555555555555555555555</BusinessName>
</Header>
</AuditFile>
Como fazer para o <Header xmlns="">
passar a <Header>
StringReplace(Texto_XML,'<Header xmlns="">', '<Header>', [rfReplaceAll]);
?