From: Steve B. <Ste...@zv...> - 2001-05-09 04:38:57
|
Todd Bradley wrote: > > I'm by no means an XML expert, so this may be a stupid > question, but I was wondering why the TclXML parser > chokes on something like this: > > <foo bar='Black & White'/> Yes, that is well-formed XML. To answer other responders who said 'just avoid entity references in attribute values' you can't: if you want both a single and double quote in the value, or a '<' character, then you must be able to use entity references. > The & is giving ParseCommand fits. If I take out > the & then things work fine. [...snip...] > Possibly relevant version numbers from xml.tcl: > > package provide xml 1.9 > > package require sgml 1.7 The behaviour you are observing is a bug that has been fixed. Get the latest code, TclXML v2.0theta, and try it again. However, that's not the whole story. The current version of TclXML can handle the predefined entities, lt, gt, quot, apos, amp, as well as character entities (<), but it cannot handle general entities. Unfortunately, this makes the parser non-conformant :-( One could argue that it is a non-validating parser and therefore is not obliged to read DTDs, but that argument fails since a non-validating parser is expected to read the internal DTD. Thus the following should parse correctly: <!DOCTYPE Sample [ <!ENTITY example "excellent"> ]> <Sample> <Example value="an &example; value"/> </Sample> The 'value' attribute of the 'Example' element should have the value 'an excellent value', but doesn't. Someone should submit a bug report on this (hint...). HTHs, Steve Ball -- Steve Ball | waX Me Lyrical XML Editor | Training & Seminars Zveno Pty Ltd | Web Tcl Complete | XML XSL http://www.zveno.com/ | TclXML TclDOM | Tcl, Web Development Ste...@zv... +---------------------------+--------------------- Ph. +61 2 6242 4099 | Mobile (0413) 594 462 | Fax +61 2 6242 4099 |