3
I am creating an XML file by Delphi and if I use the prefix when creating the first tag, the prefix "ns1" is added to all the tags that will come below, generating error in the integration with Webservice. What I need is for the first tag to be generated with the prefix and the others not.
When I use this command when creating the first tag, the prefix is repeated in all other:
xDOC := TXMLDocument.Create(nil);
xDOC.Active := True;
xDOC.Encoding := 'UTF-8';
xNOD := xDOC.AddChild('ns1:ReqEnvioLoteRPS'); // Essa linha...
if not(xNOD.NodeName = 'ReqEnvioLoteRPS') then
xNOD := xDOC.ChildNodes.FindNode('ReqEnvioLoteRPS');
xNOD := xNOD.AddChild('Cabecalho');
In this case, the "Header" tag is generated like this: "ns1:Cabecalho"
, error in the integration, as it is requested that the header be like this: "Cabecalho"
.
If I run the line without the prefix:
xNOD := xDOC.AddChild('ReqEnvioLoteRPS'); // Essa linha...
Gives error, because the integration asks for this "ns1" in the first tag.
I need "ns1" to be informed only on the main XML tag "Reqenvioloterps", and not on the other...
Right. I’ll be doing the tests here, and as soon as I can do the integration I’ll come back and mark your answer as resolved. Thank you very much!
– Rodrigo Tognin
Solved! Thanks a lot for the help @Lgregianin
– Rodrigo Tognin
I’m glad you decided.
– leogregianin