snippets

Check-in [3435a354be]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:tdom xpath search example 1
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3435a354be3064ce9fa39dd4ef3a21bb8f78b39b0fab9ba74df22bd67fb1fc17
User & Date: alex 2019-06-27 14:55:41
Context
2019-11-13
11:21
tdom nodecmd xmlns examples check-in: 10138ce489 user: alex tags: trunk
2019-06-27
14:55
tdom xpath search example 1 check-in: 3435a354be user: alex tags: trunk
14:51
tclwmf webcam image capture check-in: 060fddcbca user: alex tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tdom/tdom-xpath-1.tcl.











































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
set v(http,data) {<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE fmresultset PUBLIC "-//FMI//DTD fmresultset//EN" "https://156.67.166.120:14343/fmi/xml/fmresultset.dtd">
<fmresultset xmlns="http://www.filemaker.com/xml/fmresultset" version="1.0">
  <error code="0"/>
  <product build="4/7/2016" name="FileMaker Web Publishing Engine" version="15.0.1.137"/>
  <datasource database="sd" date-format="MM/dd/yyyy" layout="test" table="test" time-format="HH:mm:ss" timestamp-format="MM/dd/yyyy HH:mm:ss" total-count="689"/>
  <metadata>
    <field-definition auto-enter="yes" four-digit-year="no" global="no" max-repeat="1" name="recid" not-empty="yes" numeric-only="yes" result="number" time-of-day="no" type="normal"/>
    <field-definition auto-enter="yes" four-digit-year="no" global="no" max-repeat="1" name="rgnr" not-empty="no" numeric-only="no" result="text" time-of-day="no" type="normal"/>
    <field-definition auto-enter="yes" four-digit-year="no" global="no" max-repeat="10" name="preis" not-empty="no" numeric-only="no" result="number" time-of-day="no" type="normal"/>
  </metadata>
  <resultset count="1" fetch-size="1">
    <record mod-id="0" record-id="756">
      <field name="recid">
        <data>81</data>
      </field>
      <field name="rgnr">
        <data>B10042</data>
      </field>
      <field name="preis">
        <data>14,95</data>
        <data>29,95</data>
        <data/>
        <data/>
        <data/>
      </field>
    </record>
  </resultset>
</fmresultset>}

# fmresultset -> resultset -> record -> field[name="rgnr"]

package require tdom
dom parse $v(http,data) doc
set root [$doc documentElement]
set node [lindex [$root selectNodes -namespaces [list X [$root namespaceURI]] {//X:field[@name='rgnr']/X:data/text()}] 0]
puts rgnr=[$node nodeValue]