Both sides previous revisionPrevious revisionNext revision | Previous revision |
dev:technologies [2011/04/21 02:46] – ajlyon | dev:technologies [2017/12/12 04:56] (current) – removed sean |
---|
A very brief introduction to some commonly used technologies used in translator development. | |
| |
====== XPath ====== | |
<code> | |
<div id="names"> | |
<span class="editor">George Spelvin</span>, | |
<span class="translator">Andrea Johnson</span> | |
</div> | |
<table> | |
<tr class="odd"> | |
<td>Great Expectations</td> | |
<td>Mediocre Plans</td> | |
</tr> | |
</table> | |
</code> | |
| |
* ''/'' Separator between parts of the path | |
* ''*'' match any tag | |
* ''/ /'' one or more levels deeper (no space) | |
* ''..'' go up one level | |
* ''[]'' match a tag that has this (the contents of the brackets) | |
* ''@key'' an attribute named ''key'' | |
* ''text()'' match a text node | |
* ''[2]'' match the second matching node | |
* ''[last()]'' match the last matching node | |
* ''div[@class="important"]'' match a ''<div>'' with the attribute ''class'', with the value ''important''. | |
* ''td[contains(text(),"Expect")]'' match a ''<td>'' which contains text that contains "Expect" | |
| |
Plus much more. See the [[http://www.w3.org/TR/xpath/|XPath specification]] and the [[https://developer.mozilla.org/en/xpath|XPath documentation]] of the Mozilla Developer Network. | |
| |
=== Examples === | |
* ''/ /tr[@class="odd"]/td'' | |
* ''/ /table/ /td'' | |
* ''/ /span[@class="editor"]'' | |
| |
====== Regular Expressions ====== | |
* ''.'' matches any character | |
* ''[a-z01]'' matches any of the lowercase English letters and the numbers 0 and 1 ( | |
* ''()'' surround a match expression | |
* ''+'' Match one or more of the preceding expression | |
* ''*'' Match 0 or more of the preceding expression | |
* ''?'' Match 0 or 1 of the preceding expression | |
| |