-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdetalhe.xml
51 lines (39 loc) · 1.22 KB
/
detalhe.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?xml version="1.0" encoding="ISO-8859-1"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<description></description>
<sampleQuery>select * from {table} where id=720</sampleQuery>
</meta>
<bindings>
<select itemPath="details" produces="XML">
<urls>
<url></url>
</urls>
<inputs>
<key id='id' type='xs:string' paramType='variable' required="true" />
</inputs>
<execute><![CDATA[
var q = y.query('select * from html where url="http://www.excelencias.org.br/candidatos/@candidato_n.php?id='+id+'"');
var data = q.results;
var entry = <details></details>;
cpf = new RegExp("\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}").exec(data); // search by id in entire a tag
cpf = cpf[0];
data_txt = y.xpath(data,"//p[@id='txt']")
nome = new RegExp("batismo(.*)\\s+:\\s+(.*)\\s+(.*)").exec(data_txt);
if (nome != null) {
nome = nome[3];
}
data_img = y.xpath(data,"//img")
y.log(data_img);
image_url = new RegExp('src=\"(.*jpg)\"').exec(data_img);
if (image_url != null) {
image_url = image_url[1];
}
entry.appendChild(<cpf>{cpf}</cpf>); //
entry.appendChild(<nome>{nome}</nome>);
entry.appendChild(<image_url>{image_url}</image_url>);
response.object = entry;
]]></execute>
</select>
</bindings>
</table>