Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch attributeNames Excluding Merge-Ins
This is equivalent to a diff from 82c3e1a6bf to e212f6deff
2018-05-17
| ||
20:48 | Added new method attributeNames to domNode (cmds). check-in: 6cdb7b929b user: rolf tags: trunk | |
02:07 | Explained better what the domNode attributes method does and added a few words of documentation about the new simple attributeNames method. Closed-Leaf check-in: e212f6deff user: rolf tags: attributeNames | |
01:45 | Added a few tests. check-in: fef3d03e08 user: rolf tags: attributeNames | |
2018-05-15
| ||
00:10 | Added attributeNames method to domNode (cmds), simply returning the literal attriubte names. check-in: acce545518 user: rolf tags: attributeNames | |
2018-05-10
| ||
23:34 | Added note about the new pull parser methods to CHANGES. check-in: 82c3e1a6bf user: rolf tags: trunk | |
23:29 | Added new methods line and column to most pull parser states. check-in: b35e690afe user: rolf tags: trunk | |
Changes to doc/domNode.html.
1 2 3 4 5 6 | <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 $"><meta charset="utf-8"> </head><body> <div class="header"> <div class="navbar" align="center"> | | | | | | 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 | <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 $"><meta charset="utf-8"> </head><body> <div class="header"> <div class="navbar" align="center"> <a href="#SECTid0xd75c60">NAME</a> · <a href="#SECTid0xc89db0">SYNOPSIS</a> · <a href="#SECTid0xd6fd90"> DESCRIPTION </a> · <a href="#SECTid0xdd72b0">SEE ALSO</a> · <a href="#SECTid0xdd7640">KEYWORDS</a> </div><hr class="navsep"> </div><div class="body"> <h2><a name="SECTid0xd75c60">NAME</a></h2><p class="namesection"> <b class="names">domNode - </b><br>Manipulates an instance of a DOM node object</p> <h2><a name="SECTid0xc89db0">SYNOPSIS</a></h2><pre class="syntax">$nodeObject <i class="m">method</i> <i class="m">arg arg ...</i> </pre><pre class="syntax">domNode <i class="m">nodeToken</i> <i class="m">method</i> <i class="m">arg arg ...</i> </pre> <h2><a name="SECTid0xd6fd90"> 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 |
︙ | ︙ | |||
228 229 230 231 232 233 234 | the namespace <i class="m">uri</i>.</dd> <dt> <b class="method">attributes</b> <b class="option">?attributeNamePattern?</b> </dt> | > > > > > > > > > > > > > > > > > > | | | | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | the namespace <i class="m">uri</i>.</dd> <dt> <b class="method">attributes</b> <b class="option">?attributeNamePattern?</b> </dt> <dd>Returns information about the attriubtes matching the <i class="m">attributeNamePattern</i>. If <i class="m">attributeNamePattern</i> isn't given, information about all attributes are returned. The return value is a Tcl list, the elements just the attriubute name in case of non namespaced attriubtes and three element sublists for namespaced attributes. n case of an "ordinary" namespaced attribute, the sublist elements are {<localname> <prefix> <namespace_uri>}. In the special case of an xml namespace declaration it is {<the prefix defined> <localname> ""}. </dd> <dt> <b class="method">attributeNames</b> <b class="option">?attributeNamePattern?</b> </dt> <dd>Returns a flat list of all attributes names (as found in the XML source) matching the <i class="m">attributeNamePattern</i>. If <i class="m">attributeNamePattern</i> isn't given, all attribute names are returned as a Tcl list.</dd> <dt> <b class="method">appendChild</b> <i class="m">newChild</i> </dt> <dd>Appends <i class="m">newChild</i> to the end of the child list of the node.</dd> |
︙ | ︙ | |||
732 733 734 735 736 737 738 | </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> | | | | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | </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="SECTid0xdd72b0">SEE ALSO</a></h2><p class="seealso">dom, domDoc</p> <h2><a name="SECTid0xdd7640">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> · <a class="navaid" href="http://tdom.org">Repository</a> </div> </body> </html> |
Changes to doc/domNode.n.
︙ | ︙ | |||
315 316 317 318 319 320 321 | .RE .TP \&\fB\fBremoveAttributeNS\fP \fIuri\fB \fIlocalName\fB \&\fRRemoves the attribute with the local name \fIlocalName\fR within the namespace \fIuri\fR. .TP \&\fB\fBattributes\fP \fB?attributeNamePattern?\fP | > > > > > > > > > > > > > | | | | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | .RE .TP \&\fB\fBremoveAttributeNS\fP \fIuri\fB \fIlocalName\fB \&\fRRemoves the attribute with the local name \fIlocalName\fR within the namespace \fIuri\fR. .TP \&\fB\fBattributes\fP \fB?attributeNamePattern?\fP \&\fRReturns information about the attriubtes matching the \&\fIattributeNamePattern\fR. If \fIattributeNamePattern\fR isn't given, information about all attributes are returned. The return value is a Tcl list, the elements just the attriubute name in case of non namespaced attriubtes and three element sublists for namespaced attributes. n case of an "ordinary" namespaced attribute, the sublist elements are {<localname> <prefix> <namespace_uri>}. In the special case of an xml namespace declaration it is {<the prefix defined> <localname> ""}. .TP \&\fB\fBattributeNames\fP \fB?attributeNamePattern?\fP \&\fRReturns a flat list of all attributes names (as found in the XML source) matching the \fIattributeNamePattern\fR. If \&\fIattributeNamePattern\fR isn't given, all attribute names are returned as a Tcl list. .TP \&\fB\fBappendChild\fP \fInewChild\fB \&\fRAppends \fInewChild\fR to the end of the child list of the node. .TP \&\fB\fBinsertBefore\fP \fInewChild\fB \fIrefChild\fB \&\fRInserts \fInewChild\fR before the \fIrefChild\fR into the list of |
︙ | ︙ |
Changes to doc/domNode.xml.
︙ | ︙ | |||
206 207 208 209 210 211 212 | <command><method>removeAttributeNS</method> <m>uri</m> <m>localName</m></command> <desc>Removes the attribute with the local name <m>localName</m> within the namespace <m>uri</m>.</desc> </commanddef> <commanddef> <command><method>attributes</method> <option>?attributeNamePattern?</option></command> | > > > > > > > > > > > > > > > > | | | | | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | <command><method>removeAttributeNS</method> <m>uri</m> <m>localName</m></command> <desc>Removes the attribute with the local name <m>localName</m> within the namespace <m>uri</m>.</desc> </commanddef> <commanddef> <command><method>attributes</method> <option>?attributeNamePattern?</option></command> <desc>Returns information about the attriubtes matching the <m>attributeNamePattern</m>. If <m>attributeNamePattern</m> isn't given, information about all attributes are returned. The return value is a Tcl list, the elements just the attriubute name in case of non namespaced attriubtes and three element sublists for namespaced attributes. n case of an "ordinary" namespaced attribute, the sublist elements are {<localname> <prefix> <namespace_uri>}. In the special case of an xml namespace declaration it is {<the prefix defined> <localname> ""}. </desc> </commanddef> <commanddef> <command><method>attributeNames</method> <option>?attributeNamePattern?</option></command> <desc>Returns a flat list of all attributes names (as found in the XML source) matching the <m>attributeNamePattern</m>. If <m>attributeNamePattern</m> isn't given, all attribute names are returned as a Tcl list.</desc> </commanddef> <commanddef> <command><method>appendChild</method> <m>newChild</m></command> <desc>Appends <m>newChild</m> to the end of the child list of the node.</desc> </commanddef> <commanddef> |
︙ | ︙ |
Changes to generic/tcldom.c.
︙ | ︙ | |||
303 304 305 306 307 308 309 310 311 312 313 314 315 316 | " setAttribute attrName value ?attrName value ...? \n" " removeAttribute attrName \n" " hasAttributeNS uri localName \n" " getAttributeNS uri localName ?defaultValue? \n" " setAttributeNS uri attrName value ?attrName value ...? \n" " removeAttributeNS uri attrName \n" " attributes ?attrNamePattern? \n" " appendChild new \n" " insertBefore new ref \n" " replaceChild new old \n" " removeChild child \n" " cloneNode ?-deep? \n" " ownerDocument \n" " getElementsByTagName name \n" | > | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | " setAttribute attrName value ?attrName value ...? \n" " removeAttribute attrName \n" " hasAttributeNS uri localName \n" " getAttributeNS uri localName ?defaultValue? \n" " setAttributeNS uri attrName value ?attrName value ...? \n" " removeAttributeNS uri attrName \n" " attributes ?attrNamePattern? \n" " attributeNames ?attrNamePattern? \n" " appendChild new \n" " insertBefore new ref \n" " replaceChild new old \n" " removeChild child \n" " cloneNode ?-deep? \n" " ownerDocument \n" " getElementsByTagName name \n" |
︙ | ︙ | |||
4379 4380 4381 4382 4383 4384 4385 | "target", "data", "selectNodes", "namespaceURI", "getAttributeNS", "setAttributeNS", "hasAttributeNS", "removeAttributeNS", "asHTML", "prefix", "getBaseURI", "appendFromScript", "xslt", "toXPath", "delete", "getElementById", "getElementsByTagName", "getElementsByTagNameNS", "disableOutputEscaping", "precedes", "asText", "insertBeforeFromScript", "normalize", "baseURI", | | | 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 | "target", "data", "selectNodes", "namespaceURI", "getAttributeNS", "setAttributeNS", "hasAttributeNS", "removeAttributeNS", "asHTML", "prefix", "getBaseURI", "appendFromScript", "xslt", "toXPath", "delete", "getElementById", "getElementsByTagName", "getElementsByTagNameNS", "disableOutputEscaping", "precedes", "asText", "insertBeforeFromScript", "normalize", "baseURI", "asJSON", "jsonType", "attributeNames", #ifdef TCL_THREADS "readlock", "writelock", #endif NULL }; enum nodeMethod { m_firstChild, m_nextSibling, m_getAttribute, m_nodeName, |
︙ | ︙ | |||
4402 4403 4404 4405 4406 4407 4408 | m_target, m_data, m_selectNodes, m_namespaceURI, m_getAttributeNS, m_setAttributeNS, m_hasAttributeNS, m_removeAttributeNS, m_asHTML, m_prefix, m_getBaseURI, m_appendFromScript, m_xslt, m_toXPath, m_delete, m_getElementById, m_getElementsByTagName, m_getElementsByTagNameNS, m_disableOutputEscaping, m_precedes, m_asText, m_insertBeforeFromScript, m_normalize, m_baseURI, | | | 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 | m_target, m_data, m_selectNodes, m_namespaceURI, m_getAttributeNS, m_setAttributeNS, m_hasAttributeNS, m_removeAttributeNS, m_asHTML, m_prefix, m_getBaseURI, m_appendFromScript, m_xslt, m_toXPath, m_delete, m_getElementById, m_getElementsByTagName, m_getElementsByTagNameNS, m_disableOutputEscaping, m_precedes, m_asText, m_insertBeforeFromScript, m_normalize, m_baseURI, m_asJSON, m_jsonType, m_attributeNames #ifdef TCL_THREADS ,m_readlock, m_writelock #endif }; node = (domNode*) clientData; if (TSD(domCreateCmdMode) == DOM_CREATECMDMODE_AUTO) { |
︙ | ︙ | |||
4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 | } result = Tcl_ListObjAppendElement(interp, resultPtr, namePtr); if (result != TCL_OK) { Tcl_DecrRefCount(namePtr); return result; } } attrs = attrs->nextSibling; } break; case m_asList: CheckArgs(2,2,2,""); | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 | } result = Tcl_ListObjAppendElement(interp, resultPtr, namePtr); if (result != TCL_OK) { Tcl_DecrRefCount(namePtr); return result; } } attrs = attrs->nextSibling; } break; case m_attributeNames: CheckArgs(2,3,2,"?nameFilter?"); if (node->nodeType != ELEMENT_NODE) { SetResult(""); return TCL_OK; } filter = NULL; if (objc == 3) { filter = Tcl_GetString(objv[2]); } resultPtr = Tcl_GetObjResult(interp); attrs = node->firstAttr; while (attrs != NULL) { if (!filter || Tcl_StringMatch((char*)attrs->nodeName, filter)) { namePtr = Tcl_NewStringObj((char*)attrs->nodeName, -1); result = Tcl_ListObjAppendElement(interp, resultPtr, namePtr); if (result != TCL_OK) { Tcl_DecrRefCount(namePtr); return result; } } attrs = attrs->nextSibling; } break; case m_asList: CheckArgs(2,2,2,""); |
︙ | ︙ |
Changes to tests/domNode.test.
︙ | ︙ | |||
17 18 19 20 21 22 23 | # domNode-11.*: disableOutputEscaping # domNode-12.*: cloneNode # domNode-13.*: appendFromScript # domNode-14.*: appendFromList # domNode-15.*: delete # domNode-16.*: getAttribute # domNode-17.*: nodeType | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # domNode-11.*: disableOutputEscaping # domNode-12.*: cloneNode # domNode-13.*: appendFromScript # domNode-14.*: appendFromList # domNode-15.*: delete # domNode-16.*: getAttribute # domNode-17.*: nodeType # domNode-18.*: attributes, attributeNames # domNode-19.*: removeAttribute, removeAttributeNS # domNode-20.*: parentNode # domNode-21.*: hasChildNodes # domNode-22.*: localName, prefix # domNode-23.*: replaceChild # domNode-24.*: getLine, getColumn # domNode-25.*: hasAttribute, hasAttributeNS |
︙ | ︙ | |||
1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 | test domNode-18.6 {attributes} { $root attributes *brab* } {} test domNode-18.7 {attributes} { [$root firstChild] attributes } {} # Hmmm. This two following tests are mostly there to document the # behavior of the method, as it is. It may debatable if they should # behave this way. The optional attribute name pattern is a tDOM # DOM extension there is nothing in the rec, which could help to argue. # Therefore, it's the way, it is. test domNode-18.8 {attributes} { $root attributes *tdom* } {} test domNode-18.9 {attributes} { $root attributes foo* } {{attr1 foo http://tdom.org/ns}} $doc delete set doc [dom parse {<root attr1="bingbaz" foo:attr1="ns attr" xmlns:foo="http://tdom.org/ns1" worble2="second attr with 2 in it's name" xmlns="uri2"/>}] | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 | test domNode-18.6 {attributes} { $root attributes *brab* } {} test domNode-18.7 {attributes} { [$root firstChild] attributes } {} test domNode-18.1.1 {attributeNames} { $root attributeNames } {xmlns:foo attr1 attr2 attr3 foo:attr1 worble2} test domNode-18.2.1 {attributeNames} { $root attributeNames * } {xmlns:foo attr1 attr2 attr3 foo:attr1 worble2} test domNode-18.3.1 {attributeNames} { $root attributeNames attr* } {attr1 attr2 attr3} test domNode-18.4.1 {attributeNames} { $root attributeNames *2* } {attr2 worble2} test domNode-18.5.1 {attributeNames} { $root attributeNames worble2 } {worble2} test domNode-18.6.1 {attributeNames} { $root attributeNames *brab* } {} test domNode-18.7.1 {attributeNames} { [$root firstChild] attributeNames } {} # Hmmm. This two following tests are mostly there to document the # behavior of the method, as it is. It may debatable if they should # behave this way. The optional attribute name pattern is a tDOM # DOM extension there is nothing in the rec, which could help to argue. # Therefore, it's the way, it is. test domNode-18.8 {attributes} { $root attributes *tdom* } {} test domNode-18.9 {attributes} { $root attributes foo* } {{attr1 foo http://tdom.org/ns}} test domNode-18.9.1 {attributeNames} { $root attributeNames foo:* } {foo:attr1} $doc delete set doc [dom parse {<root attr1="bingbaz" foo:attr1="ns attr" xmlns:foo="http://tdom.org/ns1" worble2="second attr with 2 in it's name" xmlns="uri2"/>}] |
︙ | ︙ |