XML Parser, interleaving text and elements

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Sep 10 04:47:56 UTC 2003


Julian Fitzell <julian at beta4.com> wrote:
	I'm not sure why I didn't notice this when this message first
	showed up, but is there any chance it just works if you use:
	
	<br />
	<input href="y" />  (not that input tags have href attributes... not 
	sure where this came from :) )
	
Note that the XML specification says plainly that
any time you have <foo ....../> you may also have <foo .....></foo>.
So it might be worth trying
    <br></br>
    <input href="y"></input>
as well.  This isn't technically speaking legal HTML, but it isn't
as grossly illegal as <br /> or <br/>, and there's a fair chance an
HTML browser will just ignore end-tags for EMPTY elements.

	> What's up with self-closing tags, anyway?  XML throws away all the
	> niceties of SGML... and then adds this?  What a nuisance.
	
	Well, it's just a short cut for an empty tag.  You could remove it but 
	it isn't hard to parse and it is cleaner to look at (and xml is 
	/supposed/ to be human-readable :) ).
	
No, XML is *not* supposed to be human-readable.  XML is supposed to be
easy for *machines* to read, and it is (as long as you don't really use
most of its features...).  Readability for people, in the cases where it
occurs, is more of a lucky accident.



More information about the Squeak-dev mailing list