title: Parse SOAP faultstring in Delphi
body: <p>I am trying to parse in Delphi xml like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;soap:Body&gt;
       &lt;soap:Fault&gt;
        &lt;faultcode&gt;soap:Server&lt;/faultcode&gt;
        &lt;faultstring&gt;java.lang.ClassNotFoundException&lt;/faultstring&gt;
      &lt;/soap:Fault&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>Delphi code:</p>
  
  <pre><code>program TestXML;
  
  {$APPTYPE CONSOLE}
  
  {$R *.res}
  
  uses
    System.SysUtils,
    Xml.xmldom,
    Xml.XMLIntf,
    Xml.XMLDoc,
    ActiveX;
  
  var
    XMLDoc: TXMLDocument;
    Root,Body,Fault,Node: IXMLNode;
  
  begin
    CoInitialize(nil);
    try
      XMLDoc := TXMLDocument.Create(nil);
      XMLDoc.Options := XmlDoc.Options - [doNodeAutoCreate];
      XMLDoc.LoadFromFile('test.xml');
      Root := XMLDoc.DocumentElement;
      Body := Root.ChildNodes['Body'];
      Writeln(Body.NodeName);
      Fault := Body.ChildNodes['Fault'];
      Writeln(Fault.NodeName);
      try
        Node := Fault.ChildNodes['faultcode'];
        Writeln(Node.Text);
      except
        on E:exception do Writeln(E.Message); // "Node "faultcode not found".
      end;
    finally
      CoUnInitialize;
    end;
  end.
  </code></pre>
  
  <p>I guess the problem is: the parent node "Fault" has the namespace "<a href="http://schemas.xmlsoap.org/soap/envelope/" rel="nofollow noreferrer">http://schemas.xmlsoap.org/soap/envelope/</a>" and has the prefix "soap" but the child node "faultcode" has no namespace and has no prefix.</p>
  
  <p>How is it possibe to get an interface to the node "faultcode"?</p>
  
  <p>Thank you.</p>