Error processing request
Parameters
CONTENT_LENGTH | 0 |
REQUEST_METHOD | GET |
REQUEST_URI | /revision/TclDOM?V=49 |
QUERY_STRING | V=49 |
CONTENT_TYPE | |
DOCUMENT_URI | /revision/TclDOM |
DOCUMENT_ROOT | /var/www/nikit/nikit/nginx/../docroot |
SCGI | 1 |
SERVER_PROTOCOL | HTTP/1.1 |
HTTPS | on |
REMOTE_ADDR | 172.70.179.40 |
REMOTE_PORT | 52256 |
SERVER_PORT | 4443 |
SERVER_NAME | wiki.tcl-lang.org |
HTTP_HOST | wiki.tcl-lang.org |
HTTP_CONNECTION | Keep-Alive |
HTTP_ACCEPT_ENCODING | gzip, br |
HTTP_X_FORWARDED_FOR | 3.141.7.7 |
HTTP_CF_RAY | 8866b53dca100271-ORD |
HTTP_X_FORWARDED_PROTO | https |
HTTP_CF_VISITOR | {"scheme":"https"} |
HTTP_ACCEPT | */* |
HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected]) |
HTTP_REFERER | http://tcl.wiki/revision/TclDOM?V=49 |
HTTP_CF_CONNECTING_IP | 3.141.7.7 |
HTTP_CDN_LOOP | cloudflare |
HTTP_CF_IPCOUNTRY | US |
Body
Error
Unknow state transition: LINE -> END
-code
1
-level
0
-errorstack
INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit TclDOM {TclDOM, maintained at http://sourceforge.net/projects/tclxml ,
is the [DOM] part of [Explain]'s [TclXML] project.
| What:| TclDOM|
| Where:| http://tclxml.sf.net/|
| Description:| TclDOM is a binding for the Document Object Model. TclDOM features live node lists and named node maps. Now included in [TclXML].|
| Updated:| 12/2008|
| Contact:| mailto:[email protected]|
----
Examples and Tutorials
* [Get an XPath location path from a DOM node]
* [XSD schema validate an XML document]
Please add topics that you would like to see to help you to learn how to use TclDOM.
----
TclDOM has partial pure-Tcl-coded [XPath] support, as of September 2001.
An example application using TclDOM/libxml2 is tkxmllint, a [GUI] for xmllint.
For [Mac OS X] or [Windows] at http://tclxml.sourceforge.net/tkxmllint.html
Version 2.5 of TclDOM adds a couple of new example scripts that may
be useful:
domtext: displays a DOM document in a Tk Text widget
domtree: displays a DOM document's tree structure in a
BWidget Tree widget.
Version 3.0 includes the source script for tkxmllint (http://tclxml.sourceforge.net/tkxmllint.html) application.
----
Newcomers may find the comparison [TclDOM vs tDOM] useful in deciding between the two competing [package]s.
----
[Andreas Kupries] provides a daily snapshot of the [SourceForge] [CVS] depot
at http://www.purl.org/net/akupries/soft/cvs-snapshots/ .
[AK]: Note: There are ways of [Getting Tcl/Tk] other than my site.
[SRB]: Most recent TclDOM distributions provide Mac OS X and MS Windows binaries.
[ActiveState]'s [ActiveTcl] provides the ability to use this package - after installing an ActiveTcl of 8.4.something or newer, read up on the [teacup] command
for the method of adding additional extension packages.
----
Documentation appears (also?) at http://aspn.activestate.com/ASPN/Products/ActiveTcl/tcldom/index.html .
----
If you are trying to load TclDOM into a safe slave interpreter see the notes under [TclXML]. - [PT]
----
[Steve Ball]: "The only software in the TclXML stable that will validate a document is
TclDOM/libxml2.". This package is also known as ''Tcldomxml''. It wraps a TclDOM-API
around [GNOME]'s libxml2 [http://xmlsoft.org/] and provides the basis for [TclXSLT].
Version 3.0 provides XML Schema and RelaxNG validation, in addition to DTD validation.
----
[CThatcher]: TclDOM seems to be missing a few important features - like the ability to parse new data into an arbitrary place in a DOM document. The only parse feature creates a new document each time and most of the ::node:: operations (like appendChild) simply complain that the node needs to be in the same document. If anyone knows a quick and easy way to do the above with TclDOM please let me know.
[Steve Ball]: (Updated) DOM Level 3 introduces an "importNode" method that solves this problem. This has been implemented in TclDOM/tcl v3.0b2 (an implementation for TclDOM/libxml2 is on the TODO list).
[CThatcher]: Additionally, there should at least be an option for parsing that allows us to control the underlying parser before parsing actually takes place. Like the handling of whitespace. In *theory* we should be treating all whitespace as is, but in practice we need to be a little more brutal than that sometimes - and, let's face it, the trim function is diabolically slow.
[Steve Ball]: How about submitting an RFE to the TclXML SourceForge tracker? (Update: The TclDOM parse method (as of version 3.0b2) passes arguments through to the TclXML parser, so enabling/disabling ignorable-whitespace can be done)
[CThatcher]: Ok, thanks Steve; I'll stop ranting and start helping. Is there a tech document on how all the DOM structures work together internally, etc., as I may look into implementing importNode myself, but I'm lazy and don't want to spend hours of trawling the source :)
[Steve Ball]: Hmmm... no there isn't any technical doco. I'll put that on my to-do list.
----
[lv] there is something called '''tcldompro''' - is this an obsolete package?
Does it provide functionality that is no longer needed or has been deprecated in favor of some other package?
[Steve Ball]: "tcldompro" is a C implementation of the TclDOM API. It is included in the TclDOM distribution (in the "src" directory), but not built by default. Originally written by Al Biggerstaff (when at [Ajuba Solutions]), it is currently maintained by [Joe English].
----
Windows might require
package require xml
package require xml::libxml2
package require dom
to load the package correctly.
----
Several aspects of TclDOM's documentation haven't kept pace with the package itself.
Miscellaneous observations:
* "The -attributes option of the node command gives you the name of a Tcl array (ie. it's a 'live' variable) that contains the attribute names and values."
* ...
[Steve Ball] (2006-11-29): I just checked the v3.1 documentation online at tclxml.sf.net and it correctly documents the -attributes option.
----
This code will validate an XML document using a schema file.
set fd [open "foo.xml"]
set xml_instance [read $ch]
close $fd
set doc [dom::parse $xml_instance] ;# this is the instance XML document
set fd [open "foo.xsd"]
set schemaxml [read $fd]
close $fd
set schemadoc [dom::parse $schemaxml] ;# this is the schema XML document
$schemadoc schema compile
if {[catch {$schemadoc schema validate $doc} msg]} {
puts stderr "document is not schema-valid due to \"$msg\""
} else {
puts stderr "document is schema-valid"
}
Could someone post an example of how getElementsByTagName works? Thanks.
----
[tkxmllint]
----
Anyone know how compatibility is with Tcl 8.5.x?
[DrASK] I'm thinking not good, here's what happens to me:
% info patchlevel
8.5.4
% package require dom
attempt to provide package sgmlparser 1.1 failed: package sgmlparser 1.0 provided instead
% package present dom
package dom is not present
[SRB] 2008-12-17 - TclXML v3.2 has been built and tested against Tcl 8.5.5.
[SRB] 2009-07-13 - TclXML v3.3 (not yet released) has been built and tested against Tcl 8.6b2.
----
'''[cokh] - 2012-05-27 10:31:35'''
<How do I keep ALL of the original comments and print with the original newlines?>
----
How can I catch a parse error? dom::parse gives a segmentation fault when the XML doc is invalid (like a missing '<').
======
$ tclsh
% package require xml
3.2
% set xmlstr "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Node/>"
<?xml version="1.0" encoding="UTF-8"?><Node/>
% set doc [dom::parse $xmlstr]
doc0
% set xmlstr "<?xml version=\"1.0\" encoding=\"UTF-8\"?>Node/>"
<?xml version="1.0" encoding="UTF-8"?>Node/>
% set doc [dom::parse $xmlstr]
Segmentation fault
======
I haven't found how to use -parser tcl yet. Any clues?
======
I have a server project where the server receives an XML doc via TCP socket, and spews out a slightly modified XML doc (with additional nodes) to clients every 200ms. My idea was to parse the original XML doc to a TclDOM doc, then clone the document node and append this to a newly created document, and add the new information before sending to connected clients. After sending, destroy the new doc before the next 200ms. Trouble is, in libxml there is a segv with null pointer free. Now looking at tDOM.
<<categories>> Package | XML} regexp2} CALL {my render TclDOM {TclDOM, maintained at http://sourceforge.net/projects/tclxml ,
is the [DOM] part of [Explain]'s [TclXML] project.
| What:| TclDOM|
| Where:| http://tclxml.sf.net/|
| Description:| TclDOM is a binding for the Document Object Model. TclDOM features live node lists and named node maps. Now included in [TclXML].|
| Updated:| 12/2008|
| Contact:| mailto:[email protected]|
----
Examples and Tutorials
* [Get an XPath location path from a DOM node]
* [XSD schema validate an XML document]
Please add topics that you would like to see to help you to learn how to use TclDOM.
----
TclDOM has partial pure-Tcl-coded [XPath] support, as of September 2001.
An example application using TclDOM/libxml2 is tkxmllint, a [GUI] for xmllint.
For [Mac OS X] or [Windows] at http://tclxml.sourceforge.net/tkxmllint.html
Version 2.5 of TclDOM adds a couple of new example scripts that may
be useful:
domtext: displays a DOM document in a Tk Text widget
domtree: displays a DOM document's tree structure in a
BWidget Tree widget.
Version 3.0 includes the source script for tkxmllint (http://tclxml.sourceforge.net/tkxmllint.html) application.
----
Newcomers may find the comparison [TclDOM vs tDOM] useful in deciding between the two competing [package]s.
----
[Andreas Kupries] provides a daily snapshot of the [SourceForge] [CVS] depot
at http://www.purl.org/net/akupries/soft/cvs-snapshots/ .
[AK]: Note: There are ways of [Getting Tcl/Tk] other than my site.
[SRB]: Most recent TclDOM distributions provide Mac OS X and MS Windows binaries.
[ActiveState]'s [ActiveTcl] provides the ability to use this package - after installing an ActiveTcl of 8.4.something or newer, read up on the [teacup] command
for the method of adding additional extension packages.
----
Documentation appears (also?) at http://aspn.activestate.com/ASPN/Products/ActiveTcl/tcldom/index.html .
----
If you are trying to load TclDOM into a safe slave interpreter see the notes under [TclXML]. - [PT]
----
[Steve Ball]: "The only software in the TclXML stable that will validate a document is
TclDOM/libxml2.". This package is also known as ''Tcldomxml''. It wraps a TclDOM-API
around [GNOME]'s libxml2 [http://xmlsoft.org/] and provides the basis for [TclXSLT].
Version 3.0 provides XML Schema and RelaxNG validation, in addition to DTD validation.
----
[CThatcher]: TclDOM seems to be missing a few important features - like the ability to parse new data into an arbitrary place in a DOM document. The only parse feature creates a new document each time and most of the ::node:: operations (like appendChild) simply complain that the node needs to be in the same document. If anyone knows a quick and easy way to do the above with TclDOM please let me know.
[Steve Ball]: (Updated) DOM Level 3 introduces an "importNode" method that solves this problem. This has been implemented in TclDOM/tcl v3.0b2 (an implementation for TclDOM/libxml2 is on the TODO list).
[CThatcher]: Additionally, there should at least be an option for parsing that allows us to control the underlying parser before parsing actually takes place. Like the handling of whitespace. In *theory* we should be treating all whitespace as is, but in practice we need to be a little more brutal than that sometimes - and, let's face it, the trim function is diabolically slow.
[Steve Ball]: How about submitting an RFE to the TclXML SourceForge tracker? (Update: The TclDOM parse method (as of version 3.0b2) passes arguments through to the TclXML parser, so enabling/disabling ignorable-whitespace can be done)
[CThatcher]: Ok, thanks Steve; I'll stop ranting and start helping. Is there a tech document on how all the DOM structures work together internally, etc., as I may look into implementing importNode myself, but I'm lazy and don't want to spend hours of trawling the source :)
[Steve Ball]: Hmmm... no there isn't any technical doco. I'll put that on my to-do list.
----
[lv] there is something called '''tcldompro''' - is this an obsolete package?
Does it provide functionality that is no longer needed or has been deprecated in favor of some other package?
[Steve Ball]: "tcldompro" is a C implementation of the TclDOM API. It is included in the TclDOM distribution (in the "src" directory), but not built by default. Originally written by Al Biggerstaff (when at [Ajuba Solutions]), it is currently maintained by [Joe English].
----
Windows might require
package require xml
package require xml::libxml2
package require dom
to load the package correctly.
----
Several aspects of TclDOM's documentation haven't kept pace with the package itself.
Miscellaneous observations:
* "The -attributes option of the node command gives you the name of a Tcl array (ie. it's a 'live' variable) that contains the attribute names and values."
* ...
[Steve Ball] (2006-11-29): I just checked the v3.1 documentation online at tclxml.sf.net and it correctly documents the -attributes option.
----
This code will validate an XML document using a schema file.
set fd [open "foo.xml"]
set xml_instance [read $ch]
close $fd
set doc [dom::parse $xml_instance] ;# this is the instance XML document
set fd [open "foo.xsd"]
set schemaxml [read $fd]
close $fd
set schemadoc [dom::parse $schemaxml] ;# this is the schema XML document
$schemadoc schema compile
if {[catch {$schemadoc schema validate $doc} msg]} {
puts stderr "document is not schema-valid due to \"$msg\""
} else {
puts stderr "document is schema-valid"
}
Could someone post an example of how getElementsByTagName works? Thanks.
----
[tkxmllint]
----
Anyone know how compatibility is with Tcl 8.5.x?
[DrASK] I'm thinking not good, here's what happens to me:
% info patchlevel
8.5.4
% package require dom
attempt to provide package sgmlparser 1.1 failed: package sgmlparser 1.0 provided instead
% package present dom
package dom is not present
[SRB] 2008-12-17 - TclXML v3.2 has been built and tested against Tcl 8.5.5.
[SRB] 2009-07-13 - TclXML v3.3 (not yet released) has been built and tested against Tcl 8.6b2.
----
'''[cokh] - 2012-05-27 10:31:35'''
<How do I keep ALL of the original comments and print with the original newlines?>
----
How can I catch a parse error? dom::parse gives a segmentation fault when the XML doc is invalid (like a missing '<').
======
$ tclsh
% package require xml
3.2
% set xmlstr "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Node/>"
<?xml version="1.0" encoding="UTF-8"?><Node/>
% set doc [dom::parse $xmlstr]
doc0
% set xmlstr "<?xml version=\"1.0\" encoding=\"UTF-8\"?>Node/>"
<?xml version="1.0" encoding="UTF-8"?>Node/>
% set doc [dom::parse $xmlstr]
Segmentation fault
======
I haven't found how to use -parser tcl yet. Any clues?
======
I have a server project where the server receives an XML doc via TCP socket, and spews out a slightly modified XML doc (with additional nodes) to clients every 200ms. My idea was to parse the original XML doc to a TclDOM doc, then clone the document node and append this to a newly created document, and add the new information before sending to connected clients. After sending, destroy the new doc before the next 200ms. Trouble is, in libxml there is a segv with null pointer free. Now looking at tDOM.
<<categories>> Package | XML}} CALL {my revision TclDOM} CALL {::oo::Obj2266796 process revision/TclDOM} CALL {::oo::Obj2266794 process}
-errorcode
NONE
-errorinfo
Unknow state transition: LINE -> END
while executing
"error $msg"
(class "::Wiki" method "render_wikit" line 6)
invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
(class "::Wiki" method "render" line 8)
invoked from within
"my render $name $C"
(class "::Wiki" method "revision" line 31)
invoked from within
"my revision $page"
(class "::Wiki" method "process" line 56)
invoked from within
"$server process [string trim $uri /]"
-errorline
4