Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How about using some simple XPATH to get the requested values?</p> <p><code>//Link[1]/node()</code> - selects the first "Link" node from the whole document, and then selects the first child node of any kind. It just happens that the first child node is the unnamed node containing the actual <code>https</code> link.</p> <p>Assuming the XML document is loaded into <code>Doc: TXMLDocument</code>, you can extract the Link with this code:</p> <pre><code>(Doc.DOMDocument as IDomNodeSelect).selectNode('//Link[1]/node()').nodeValue </code></pre> <p>You can find some documentation about XPath <a href="http://msdn.microsoft.com/en-us/library/ms256086.aspx" rel="noreferrer">reading those XPath Examples on MSDN</a>. You might find better documentation <a href="http://www.w3schools.com/XPath/xpath_syntax.asp" rel="noreferrer">at w3schools</a>. And to top it all up, here's a simple (but complete) console application that uses XPath to extract and display the 3 requested values:</p> <pre><code>program Project14; {$APPTYPE CONSOLE} uses SysUtils, Xmldoc, xmldom, ActiveX; var X: TXMLDocument; Node: IDOMNode; Sel: IDomNodeSelect; begin try CoInitialize(nil); X := TXMLDocument.Create(nil); try // Load XML from a string constant so I can include the exact XML sample from this // question into the code. Note the "SomeNode" node, it's required to make that XML // valid. X.LoadFromXML( '&lt;SomeNode&gt;'+ ' &lt;Link role="self"&gt;' + ' https://spatial.virtualearth.net/REST/v1/dataflows/Geocode/jobid' + ' &lt;/Link&gt;' + ' &lt;Status&gt;Aborted&lt;/Status&gt;' + ' &lt;ErrorMessage&gt;The data uploaded in this request was not valid.&lt;/ErrorMessage&gt;' + '&lt;/SomeNode&gt;' ); // Shortcut: Keep a reference to the IDomNodeSelect interface Sel := X.DOMDocument as IDomNodeSelect; // Extract and WriteLn() the values. Painfully simple! WriteLn(Sel.selectNode('//Link[1]/node()').nodeValue); WriteLn(Sel.selectNode('//Status[1]/node()').nodeValue); WriteLn(Sel.selectNode('//ErrorMessage[1]/node()').nodeValue); ReadLn; finally X.Free; end; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload