[XML-SIG] Structural view of XML files?

Lars Marius Garshol larsga@garshol.priv.no
08 Nov 2000 09:18:11 +0100


* Lars Marius Garshol
|
| Have you declared your entities? 

* Dinu C. Gherman
| 
| Of course not! ;-)

Then you absolutely should, because until you do you have broken
documents.  This is like writing C code and leaving out all the
'#include' statements.

If you are using standard character entities you can probably just
steal them from the XHTML DTD and put them in your document like this:

<!DOCTYPE whatever-your-root-element-is [
  [entity declarations go here]
]>

If you do, the non-validating version of xmlproc that you use now will
read the declarations and resolve the entity references automatically.
 
| Well, I thought that would be enough to display a tree view, which
| is all I wanted. I thought there is no need for declaring or knowing
| about entities for such a simple tool, as they do not affect the
| parsing of the elements (or maybe IMHO they shouldn't).

They do, and they absolutely must.  Like Martin pointed out, entities
can perfectly well contain elements.  I'm writing my Python-XML book
now as an XML (well, SGML, really) document, and I have defined all
the chapters as entities.

Another issue is that once your document is considered to not be
well-formed it will not work anywhere. No parser will accept it.
 
--Lars M.