Posted to tcl by oldlaptop at Fri Apr 10 03:06:23 GMT 2026view raw

  1. eltclsh > expat parser
  2. parser
  3. eltclsh > tnc parser enable
  4. eltclsh > parser parse {
  5. <!DOCTYPE foo [
  6. <!ELEMENT foo EMPTY>
  7. <!ATTLIST foo
  8. bar CDATA #FIXED "baz"
  9. >
  10. ]>
  11. <foo/>
  12. }
  13. eltclsh > # no problem so far...
  14. eltclsh > tnc parser getValidateCmd validator
  15. validator
  16. eltclsh > dom parse {
  17. <!DOCTYPE foo [
  18. <!ELEMENT foo EMPTY>
  19. <!ATTLIST foo
  20. bar CDATA #FIXED "baz"
  21. >
  22. ]>
  23. <foo/>
  24. } doc1
  25. domDoc0x55ee10a48490
  26. eltclsh > validator validateDocument $doc1
  27. 1
  28. eltclsh > # still fine, because...
  29. eltclsh > $doc1 asXML
  30. <foo bar="baz"/>
  31.  
  32. eltclsh > # ...the default value got filled in explicitly
  33. eltclsh > dom createDocument foo doc2
  34. domDoc0x55ee10a480f0
  35. eltclsh > validator validateDocument $doc2 problem
  36. 0
  37. eltclsh > set problem
  38. Required attribute missing.
  39. eltclsh > $doc2 asXML
  40. <foo/>
  41.  
  42. eltclsh > # but $doc2 has never been parsed to get defaults filled in
  43.  

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week