Einzelnen Beitrag anzeigen

mjustin

Registriert seit: 14. Apr 2008
3.004 Beiträge
 
Delphi 2009 Professional
 
#2

AW: xml - soap - AddChild ohne soap:

  Alt 14. Jul 2017, 15:19
Der Fehler liegt wahrscheinlich hier:

Delphi-Quellcode:
  HeaderItem := Body.AddChild('HeaderItem');
  HeaderItem.Attributes['xmlns'] := 'http://tempuri.org/';
Es genügt nicht ein xmlns Attribut manuell hinzuzufügen, da dadurch das DOM nicht merkt dass es ein Namespace ist.

Namespace Undeclaration ist das Stichwort, eventuell hilft dies weiter:

https://stackoverflow.com/questions/...te-from-parent

Zitat:
You have to declare a namespace before you can use it. It is not enough to simply add an xmlns attribute manually, which is not the correct way to let the DOM know about the existence of the namespace. Use IXMLNode.DeclareNamespace() for that instead, eg:
Delphi-Quellcode:
CurNode := RootNode.AddChild('Child1');
CurNode.DeclareNamespace('', 'apenootje');
Michael Justin
  Mit Zitat antworten Zitat