snippets

Check-in [8c7d141406]
Login

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

Overview
Comment:tdom-xpath-1
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8c7d141406d9a8458b6e5f01654f846759d40f348dc34cc7fb8aa07c9267d8dc
User & Date: alex 2019-11-21 19:58:00
Context
2020-02-12
08:08
javascript datetime scanner / scanDT Leaf check-in: 9ba855f770 user: alex tags: trunk
2019-11-21
19:58
tdom-xpath-1 check-in: 8c7d141406 user: alex tags: trunk
2019-11-13
11:21
tdom nodecmd xmlns examples check-in: 10138ce489 user: alex tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tdom/tdom-xpath-1.tcl.

1
2
3
4
5
6
7
8
..
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"/>
................................................................................
    </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]
|







 







|



1
2
3
4
5
6
7
8
..
27
28
29
30
31
32
33
34
35
36
37
set 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"/>
................................................................................
    </record>
  </resultset>
</fmresultset>}

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

package require tdom
dom parse $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]