Environment:
* TclXml v. 2.6 (under FreeBSD-4.8-STABLE)
Try the following script:
#!/bin/sh
# Run \
exec tclsh8.4 $0
package require xml
proc attlistdeclcmd {name attrname type default value} {
puts "element: $name"
puts "name: $attrname"
puts "type: $type"
puts "default: $default"
puts "value: $value"
}
set parser [::xml::parser -attlistdeclcommand
attlistdeclcmd]
$parser parse [read stdin]
;### end of script
with this input:
<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (message)>
<!ELEMENT message (#PCDATA)>
<!ATTLIST message
number CDATA #REQUIRED
from CDATA #FIXED "Nicola Vitale"
date CDATA #REQUIRED>
]>
<nota>
<message number="1" date="071803" from="nivit">
TclXml : Bugs: Submit Tracker Item
</message>
</nota>
you get (only) this output:
element: message
name: number
type: CDATA
default: #REQUIRED
value:
The following patch seems to solve the problem:
--- sgml-8.1.tcl Fri Jul 18 15:27:27 2003
+++ sgml-8.1.tcl.new Fri Jul 18 15:20:56 2003
@@ -84,7 +84,7 @@
set attlist_exp [cl $Wsp]*([cl ^$Wsp]+)[cl
$Wsp]*([cl ^$Wsp]+)[cl $Wsp]*(#REQUIRED|#IMPLIED
)
set attlist_enum_exp [cl $Wsp]*([cl ^$Wsp]+)[cl
$Wsp]*\\(([cl ^)]*)\\)[cl $Wsp]*("([cl ^")]
*)")? ;# "
- set attlist_fixed_exp [cl $Wsp]*([cl ^$Wsp]+)[cl
$Wsp]*([cl ^$Wsp]+)[cl $Wsp]*(#FIXED)[cl $
Wsp]*([cl ^$Wsp]+)
+ set attlist_fixed_exp [cl $Wsp]*([cl ^$Wsp]+)[cl
$Wsp]*([cl ^$Wsp]+)[cl $Wsp]*(#FIXED)[cl $
Wsp]*(([cl ^$Wsp\&quot;]+)|([cl
\&quot;]{1}[cl ^\&quot;]*[cl \&quot;]{1}))
set param_entity_exp [cl $Wsp]*([cl ^$Wsp]+)[cl
$Wsp]*([cl ^"$Wsp]*)[cl $Wsp]*"([cl ^"]*)"
Logged In: YES
user_id=669597
I forgot this patch too:
--- sgmlparser.tcl Thu Jul 17 16:02:38 2003
+++ sgmlparser.tcl.new Fri Jul 18 16:36:10 2003
@@ -2560,9 +2560,9 @@
# Parse the attribute list. If it were regular, could
just use foreach,
# but some attributes may have values.
regsub -all {([][$\\])} $attspec {\\\1} attspec
- regsub -all $attlist_exp $attspec "\}\nDTDAttribute
{$options(-attlistdeclcommand)} $name $options(attlistdecls)
{\\1} {\\2
} {\\3} {} \{" attspec
regsub -all $attlist_enum_exp $attspec
"\}\nDTDAttribute {$options(-attlistdeclcommand)} $name
$options(attlistdecls) {\\1}
{\\2} {} {\\4} \{" attspec
regsub -all $attlist_fixed_exp $attspec
"\}\nDTDAttribute {$options(-attlistdeclcommand)} $name
$options(attlistdecls) {\\1
} {\\2} {\\3} {\\4} \{" attspec
+ regsub -all $attlist_exp $attspec "\}\nDTDAttribute
{$options(-attlistdeclcommand)} $name $options(attlistdecls)
{\\1} {\\2
} {\\3} {} \{" attspec
eval "noop \{$attspec\}"
Logged In: YES
user_id=81778
Thanks! I'll add the patch to the v3.0 branch that I'm working on at
the moment. An addition to the test suite is also required. If you
can supply that it would be great, otherwise I'll add it when I get
the chance.
Logged In: YES
user_id=669597
Ok, I'll send you a test suite as soon as possible.
Logged In: YES
user_id=669597
Here is an example of test swite with the previous patch
inclused too (for v3_0).