[cxml-devel] Bugs when working with document nodes

Sunil Mishra smishra at sfmishras.com
Wed Aug 16 21:26:52 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Lichteblau wrote:
> Quoting Sunil Mishra (smishra at sfmishras.com):
>> 1. clone-node when applied to a document doesn't work.
> 
> Aha.  The spec says something about implementation-dependent behaviour
> when cloning documents.  I have not investigated what other DOM
> implementations are doing here, but creating a new document referencing
> the same DTD data structures seems like a good idea.
> 
> I will implement that and let you know when it is done.

Excellent! Thank you!

> 
>> 2. create-document does not set the dtd of a document based on the
>> supplied document type definition. This for example inhibits
>> get-element-by-id from working.
> 
> create-document is indeed a very simple function that just creates a new
> document without any DTD information, similar to the result of parsing
> an "empty" XML document into DOM.
> 
> I'm not sure I understand what precise behaviour you expect from
> create-document or how to implement it.  Can you elaborate?

At present there is no API for setting the DTD of a document. Given that
some dom functions (such as get-node-from-id or something like that)
rely on having a dtd to determine which attribute is in fact an id,
seems that having a dtd in a document is quite important.

Looking at this from another point of view, when you write an xhtml
document, you have the following preamble:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC
          "-//W3C//DTD XHTML 1.0 Strict//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

When an xml document with this preamble is parsed, cxml sees the doctype
and registers the xhtml dtd, parsing the document at
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd. There is no such
thing that happens when you create a document and supply a document type
node explicitly, even though create-document-type takes as two of its
arguments the public-id -//W3C//DTD XHTML 1.0 Strict//EN and the
system-id http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd. Would it
not be reasonable to have a document using this document type to also
reference the same DTD object, as it would had it been parsed from a file?

Hope my request and motivation are clearer.

Sunil
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE442cjRnqWMAEf1cRAhagAKC3t/5muGk692xabadfWZIEiQOx1ACgrPXg
ZITJkmntP8v80xQJUNKSCEs=
=lElp
-----END PGP SIGNATURE-----



More information about the cxml-devel mailing list