Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | More tests. Minimal documentation. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | toXPath |
Files: | files | file ages | folders |
SHA1: |
9da0732eb41ac11b83a8594cab170dad |
User & Date: | rolf 2013-09-20 23:35:41 |
Context
2013-09-20
| ||
23:44 | Integrated toXPath bug fix. check-in: 85d99b56af user: rolf tags: trunk | |
23:35 | More tests. Minimal documentation. Closed-Leaf check-in: 9da0732eb4 user: rolf tags: toXPath | |
21:18 | Updated from trunk. check-in: 697274d232 user: rolf tags: toXPath | |
Changes
Changes to doc/domNode.html.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ... 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 ... 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
<html> <head> <link rel="stylesheet" href="manpage.css"><title>tDOM manual: domNode</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile$ $Revision$"> </head><body> <div class="header"> <div class="navbar" align="center"> <a href="#SECTid0x80a9a60">NAME</a> · <a href="#SECTid0x80a7378">SYNOPSIS</a> · <a href="#SECTid0x80967a8"> DESCRIPTION </a> · <a href="#SECTid0x80d2050">SEE ALSO</a> · <a href="#SECTid0x80d2270">KEYWORDS</a> </div><hr class="navsep"> </div><div class="body"> <h2><a name="SECTid0x80a9a60">NAME</a></h2><p class="namesection"> <b class="names">domNode - </b><br>Manipulates an instance of a DOM node object</p> <h2><a name="SECTid0x80a7378">SYNOPSIS</a></h2><pre class="syntax"> $nodeObject <i class="m">method</i> <i class="m">arg arg ...</i> </pre> <h2><a name="SECTid0x80967a8"> DESCRIPTION </a></h2><p>This command manipulates one particular instance of a DOM node object. <i class="m">method</i> indicates a specific method of the node class. These methods should closely conform to the W3C recommendation "Document Object Model (Core) Level 1" (<a href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html">http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html</a>) as well to parts of the W3C draft "XML Pointer Language (XPointer)" (<a href="http://www.w3.org/TR/1998/WD-xptr-19980303">http://www.w3.org/TR/1998/WD-xptr-19980303</a>). Please note, that the XPointer methods are deprecated. Use DOM methods or XPath expressions instead of them.</p><p>The selectNodes method implements the "XML Path ................................................................................ <dd>Translate the subtree starting at the object node according to the specifications in <i class="m">specifications</i> and outputs the result in the variable <i class="m">outputVar</i> . The translation is very similar to Cost Simple mode.</dd> <dt><b class="method">toXPath</b></dt> <dd>Returns an XPath, which exactly addresses the given node in its document. This XPath is only valid as there are no changes to DOM tree made later one.</dd> <dt><b class="method">getBaseURI</b></dt> <dd>Returns the baseURI of the node. This method is deprecated in favor of the <i class="m">baseURI</i> method.</dd> ................................................................................ for <i class="m">getAttribute</i>.</dd> </dl><p>Otherwise, if an unknown method name is given, the command with the same name as the given method within the namespace <tt class="l">::dom::domNode</tt> is tried to be executed. This allows quick method additions on Tcl level.</p> <h2><a name="SECTid0x80d2050">SEE ALSO</a></h2><p class="seealso">dom, domDoc</p> <h2><a name="SECTid0x80d2270">KEYWORDS</a></h2><p class="keywords"> <a class="keyword" href="keyword-index.html#KW-XML">XML</a>, <a class="keyword" href="keyword-index.html#KW-DOM">DOM</a>, <a class="keyword" href="keyword-index.html#KW-document">document</a>, <a class="keyword" href="keyword-index.html#KW-node">node</a>, <a class="keyword" href="keyword-index.html#KW-parsing">parsing</a> </p> </div><hr class="navsep"><div class="navbar" align="center"> <a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> </div> </body> </html> |
| | | | | | > | > | | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ... 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 ... 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 |
<html> <head> <link rel="stylesheet" href="manpage.css"><title>tDOM manual: domNode</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"> </head><body> <div class="header"> <div class="navbar" align="center"> <a href="#SECTid0xb3b870">NAME</a> · <a href="#SECTid0xb53db0">SYNOPSIS</a> · <a href="#SECTid0xb5e220"> DESCRIPTION </a> · <a href="#SECTid0xba0550">SEE ALSO</a> · <a href="#SECTid0xba0920">KEYWORDS</a> </div><hr class="navsep"> </div><div class="body"> <h2><a name="SECTid0xb3b870">NAME</a></h2><p class="namesection"> <b class="names">domNode - </b><br>Manipulates an instance of a DOM node object</p> <h2><a name="SECTid0xb53db0">SYNOPSIS</a></h2><pre class="syntax"> $nodeObject <i class="m">method</i> <i class="m">arg arg ...</i> </pre> <h2><a name="SECTid0xb5e220"> DESCRIPTION </a></h2><p>This command manipulates one particular instance of a DOM node object. <i class="m">method</i> indicates a specific method of the node class. These methods should closely conform to the W3C recommendation "Document Object Model (Core) Level 1" (<a href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html">http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html</a>) as well to parts of the W3C draft "XML Pointer Language (XPointer)" (<a href="http://www.w3.org/TR/1998/WD-xptr-19980303">http://www.w3.org/TR/1998/WD-xptr-19980303</a>). Please note, that the XPointer methods are deprecated. Use DOM methods or XPath expressions instead of them.</p><p>The selectNodes method implements the "XML Path ................................................................................ <dd>Translate the subtree starting at the object node according to the specifications in <i class="m">specifications</i> and outputs the result in the variable <i class="m">outputVar</i> . The translation is very similar to Cost Simple mode.</dd> <dt><b class="method">toXPath <i class="m">?-legacy?</i> </b></dt> <dd>Returns an XPath, which exactly addresses the given node in its document. This XPath is only valid as there are no changes to DOM tree made later one. With the -legacy option, other XPath expressions are returnd, which doesn't work in all cases.</dd> <dt><b class="method">getBaseURI</b></dt> <dd>Returns the baseURI of the node. This method is deprecated in favor of the <i class="m">baseURI</i> method.</dd> ................................................................................ for <i class="m">getAttribute</i>.</dd> </dl><p>Otherwise, if an unknown method name is given, the command with the same name as the given method within the namespace <tt class="l">::dom::domNode</tt> is tried to be executed. This allows quick method additions on Tcl level.</p> <h2><a name="SECTid0xba0550">SEE ALSO</a></h2><p class="seealso">dom, domDoc</p> <h2><a name="SECTid0xba0920">KEYWORDS</a></h2><p class="keywords"> <a class="keyword" href="keyword-index.html#KW-XML">XML</a>, <a class="keyword" href="keyword-index.html#KW-DOM">DOM</a>, <a class="keyword" href="keyword-index.html#KW-document">document</a>, <a class="keyword" href="keyword-index.html#KW-node">node</a>, <a class="keyword" href="keyword-index.html#KW-parsing">parsing</a> </p> </div><hr class="navsep"><div class="navbar" align="center"> <a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> </div> </body> </html> |
Changes to doc/domNode.n.
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 |
.TP \&\fB\fBsimpleTranslate\fP \fIoutputVar\fB \fIspecifications\fB \&\fRTranslate the subtree starting at the object node according to the specifications in \fIspecifications\fR and outputs the result in the variable \fIoutputVar\fR . The translation is very similar to Cost Simple mode. .TP \&\fB\fBtoXPath\fP \&\fRReturns an XPath, which exactly addresses the given node in its document. This XPath is only valid as there are no changes to DOM tree made later one. .TP \&\fB\fBgetBaseURI\fP \&\fRReturns the baseURI of the node. This method is deprecated in favor of the \fIbaseURI\fR method. .TP \&\fB\fBbaseURI \fI?URI?\fB\fP \&\fRReturns the present baseURI of the node. If the optional |
| | > |
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
.TP \&\fB\fBsimpleTranslate\fP \fIoutputVar\fB \fIspecifications\fB \&\fRTranslate the subtree starting at the object node according to the specifications in \fIspecifications\fR and outputs the result in the variable \fIoutputVar\fR . The translation is very similar to Cost Simple mode. .TP \&\fB\fBtoXPath \fI?-legacy?\fB\fP \&\fRReturns an XPath, which exactly addresses the given node in its document. This XPath is only valid as there are no changes to DOM tree made later one. With the -legacy option, other XPath expressions are returnd, which doesn't work in all cases. .TP \&\fB\fBgetBaseURI\fP \&\fRReturns the baseURI of the node. This method is deprecated in favor of the \fIbaseURI\fR method. .TP \&\fB\fBbaseURI \fI?URI?\fB\fP \&\fRReturns the present baseURI of the node. If the optional |
Changes to doc/domNode.xml.
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 |
<desc>Translate the subtree starting at the object node according to
the specifications in <m>specifications</m> and outputs the result in the
variable <m>outputVar</m> . The translation is very similar to Cost Simple
mode.</desc>
</commanddef>
<commanddef>
<command><method>toXPath</method></command>
<desc>Returns an XPath, which exactly addresses the given
node in its document. This XPath is only valid as there are no changes to DOM
tree made later one.</desc>
</commanddef>
<commanddef>
<command><method>getBaseURI</method></command>
<desc>Returns the baseURI of the node. This method is deprecated in
favor of the <m>baseURI</m> method.</desc>
</commanddef>
|
| | > |
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
<desc>Translate the subtree starting at the object node according to the specifications in <m>specifications</m> and outputs the result in the variable <m>outputVar</m> . The translation is very similar to Cost Simple mode.</desc> </commanddef> <commanddef> <command><method>toXPath <m>?-legacy?</m></method></command> <desc>Returns an XPath, which exactly addresses the given node in its document. This XPath is only valid as there are no changes to DOM tree made later one. With the -legacy option, other XPath expressions are returnd, which doesn't work in all cases.</desc> </commanddef> <commanddef> <command><method>getBaseURI</method></command> <desc>Returns the baseURI of the node. This method is deprecated in favor of the <m>baseURI</m> method.</desc> </commanddef> |
Changes to tests/domNode.test.
3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 |
$doc selectNodesNamespaces {foo foo}
set foo2 [$root selectNodes {foo:foo[2]}]
} -body {
expr {$foo2 == [[$foo2 ownerDocument] selectNodes [$foo2 toXPath]]}
} -cleanup {
$doc delete
} -result 1
test domNode-39.1 {text} {
set doc [dom parse {<root>text <b>bold</b> more text</root>}]
$doc documentElement root
set result [$root text]
$doc delete
set result
} {text more text}
|
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 |
$doc selectNodesNamespaces {foo foo} set foo2 [$root selectNodes {foo:foo[2]}] } -body { expr {$foo2 == [[$foo2 ownerDocument] selectNodes [$foo2 toXPath]]} } -cleanup { $doc delete } -result 1 test domNode0-38.8 {toXPath - pathological xml namespace} -setup { set doc [dom parse { <root> <!-- comment --> <foo:foo xmlns:foo="foo"> <bar/> text <bar xmlns=""/> </foo:foo> some text <foo:foo xmlns:foo="bar"/> <?mypi data?> <foo:foo xmlns:foo="bar"/> <foo:foo xmlns:foo="foo"> <bar/> <foo:foo xmlns:foo="bar"/> text <bar xmlns=""/> </foo:foo> <foo:foo xmlns:foo="foo"/> </root>}] } -body { set result "" foreach node [$doc selectNodes //node()] { if {$node != [[$node ownerDocument] selectNodes [$node toXPath]]} { set result [$node toXPath] break } } set result } -cleanup { $doc delete } -result "" test domNode0-38.9 {toXPath - really long element name} -constraints { knownBug } -setup { set doc [dom parse "<doc><[string repeat abc 100]/></doc>"] set root [$doc documentElement] set firstChild [$root firstChild] } -body { $firstChild toXPath } -cleanup { $doc delete } -result "/doc/[string repeat abc 100]" test domNode-39.1 {text} { set doc [dom parse {<root>text <b>bold</b> more text</root>}] $doc documentElement root set result [$root text] $doc delete set result } {text more text} |