Note that there are some explanatory texts on larger screens.

plurals
  1. POSearching for child element by the value of one of its properties
    primarykey
    data
    text
    <p>I'm extracting data from a TMX - an xml-based translation memory file. The file looks like this (<code>&lt;tu&gt;</code> entries are multiple, one for each translated string):</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;tmx version="1.4"&gt; &lt;header creationtool="Multilizer" creationtoolversion="6.2.19" datatype="PlainText" segtype="sentence" adminlang="en" srclang="*all*" o-tmf="MLProject"&gt; &lt;/header&gt; &lt;body&gt; &lt;tu&gt; &lt;prop type="context"&gt;..\..\BuildProcess\Support_Files\CommonFiles\PSRIP\AlambicEdit.dll.Strings.126.2000&lt;/prop&gt; &lt;tuv xml:lang="en-CA"&gt; &lt;seg&gt;Error initializing library: %s.&lt;/seg&gt; &lt;/tuv&gt; &lt;tuv xml:lang="en"&gt; &lt;prop type="status"&gt;tsQAed&lt;/prop&gt; &lt;seg&gt;Error initializing library: %s.&lt;/seg&gt; &lt;/tuv&gt; &lt;tuv xml:lang="fr"&gt; &lt;prop type="status"&gt;tsQAed&lt;/prop&gt; &lt;seg&gt;Erreur lors de l'initialisation de la librairie %s.&lt;/seg&gt; &lt;/tuv&gt; &lt;tuv xml:lang="de"&gt; &lt;prop type="status"&gt;tsQAed&lt;/prop&gt; &lt;seg&gt;Fehler bei der Initialisierung der Bibliothek: %s.&lt;/seg&gt; &lt;/tuv&gt; &lt;tuv xml:lang="es"&gt; &lt;prop type="status"&gt;tsQAed&lt;/prop&gt; &lt;seg&gt;Error inicializando biblioteca: %s.&lt;/seg&gt; &lt;/tuv&gt; &lt;tuv xml:lang="it"&gt; &lt;prop type="status"&gt;tsQAed&lt;/prop&gt; &lt;seg&gt;Errore di inizializzazione libreria: %s.&lt;/seg&gt; &lt;/tuv&gt; &lt;tuv xml:lang="ja"&gt; &lt;prop type="status"&gt;tsQAed&lt;/prop&gt; &lt;seg&gt;ライブラリ初期化時のエラー: %s&lt;/seg&gt; &lt;/tuv&gt; &lt;tuv xml:lang="zh-CN"&gt; &lt;prop type="status"&gt;tsQAed&lt;/prop&gt; &lt;seg&gt;初始化库时出错:%s。&lt;/seg&gt; &lt;/tuv&gt; &lt;tuv xml:lang="pt"&gt; &lt;prop type="status"&gt;tsQAed&lt;/prop&gt; &lt;seg&gt;Erro ao inicializar biblioteca: %s.&lt;/seg&gt; &lt;/tuv&gt; &lt;/tu&gt; &lt;/body&gt; &lt;/tmx&gt; </code></pre> <p>I need to extract specific languages in a specific order that's not always respected in the TMX, for instance the DE and ES languages are sometimes inverted.</p> <p>Unfortunately, I haven't found a way to get a child element by the value of it's properties, so I can't do something like <code>segment = x.getElementsByPropertyValue("xml:lang", "en")</code> , which would be really awesome. </p> <p>The only alternative I've found was to loop through <em>all</em> of the languages and check them against a properly sorted language array (which would be horribly slow on 600k+ entries in 10 different files).</p> <p>Is there something obvious I'm missing? Is there such a method?</p> <p>Note: I'm in WSH Javascript, so I have access to any ActiveXObject available in WSH...</p>
    singulars
    1. This table or related slice is empty.
    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