Note that there are some explanatory texts on larger screens.

plurals
  1. PORead ID and statusnodes of xml
    primarykey
    data
    text
    <p>I have a problem with reading some xml nodes with Delphi. I want to read the id from this xml code</p> <p>example:</p> <pre><code>&lt;row name="String.101" status="new" comment=""&gt; &lt;native&gt;&amp;quot;User Name&amp;quot;&lt;/native&gt; &lt;lang id="en" status="ready"&gt;&amp;quot;User Name&amp;quot;&lt;/lang&gt; &lt;lang id="fr" status="translated"&gt;&amp;quot;Nom d&amp;apos;utilisateur&amp;quot;&lt;/lang&gt; &lt;lang id="hu" status="translated"&gt;&amp;quot;Felhasználó neve&amp;quot;&lt;/lang&gt; &lt;lang id="it" status="translated"&gt;&amp;quot;Nome utente&amp;quot;&lt;/lang&gt; &lt;lang id="zh" status="translated"&gt;&amp;quot;用户名&amp;quot;&lt;/lang&gt; &lt;lang id="de" status="ready"&gt;&amp;quot;Benutzername&amp;quot;&lt;/lang&gt; &lt;/row&gt; </code></pre> <p>My program should show me the 'en' in "id="en"' but it shows me "User Name" at the end of the line.</p> <p>Where are my errors in my delphi code?</p> <pre><code>begin TransNodes := XMLDocument.DocumentElement.ChildNodes['targets'].ChildNodes['target'].ChildNodes['stringdata'].ChildNodes; for i := 0 to TransNodes.Count -1 do begin sContext := TransNodes[i].Attributes['name']; sOriginalStatus := TransNodes[i].Attributes['status']; sNativeText := TransNodes[i].ChildNodes['native'].Text; sLangId := TransNodes[i].ChildNodes['id'].Text; sStatus := TransNodes[i].ChildNodes['status'].Text; Delete(sNativeText, Length(sNativeText), 1); Delete(sNativeText, 1, 1); Delete(sLangId, Length(sLangId), 1); Delete(sLangId, 1, 1); Delete(sStatus, Length(sStatus), 1); Delete(sStatus, 1, 1); Memo.Lines.Add(sContext + ' ' + sOriginalStatus + ' ' + sNativeText + ' ' + sLangId + ' ' + sStatus); </code></pre> <p>i tried it with .Attributes and with .ChildNodes... with .Attributes delphi shwos me an error. The same problem with status. i want, for example, 'status="ready"' but he shows me nothing.</p> <p>Thank you for your help and time.</p>
    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.
 

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