[cxml-devel] Bugs when working with document nodes

David Lichteblau david at lichteblau.com
Sun Aug 20 14:17:42 UTC 2006


Hi,

Quoting Sunil Mishra (smishra at sfmishras.com):
> 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.

I am not convinced that DOMImplementation.createDocumentType() is meant
to go and start parsing DTDs.

Instead, I have implemented a new function CXML:PARSE-EMPTY-DOCUMENT,
which will look for DTDs like the other parser functions do, and that
can be used together with a DOM builder to create a new DOM document.

I hope that works for you; please test!


Example below.


Thanks,
David
--------
CL-USER(52): (cxml:parse-empty-document
	      #"http://www.w3.org/1999/xhtml"
	      #"html"
	      (cxml-dom:make-dom-builder)
	      :public-id #"-//W3C//DTD XHTML 1.0 Transitional//EN"
	      :system-id
	      #u"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd")
#<UTF8-DOM::DOCUMENT {BD01A19}>
CL-USER(53): (describe *)
#<UTF8-DOM::DOCUMENT {BD01A19}>
is an instance of class #<STANDARD-CLASS UTF8-DOM::DOCUMENT>.
The following slots have :INSTANCE allocation:
 PARENT             NIL
 CHILDREN           #(#<UTF8-DOM::ELEMENT html {C1EE099}>)
 OWNER              NIL
 READ-ONLY-P        NIL
 MAP                NIL
 DOC-TYPE           #<UTF8-DOM::DOCUMENT-TYPE {BD02001}>
 DTD                #S(CXML::DTD
                       :ELEMENTS #<HASH-TABLE :TEST EQUALP :COUNT 89 {BD074B9}>
                       :GENTITIES #<HASH-TABLE :TEST EQUALP :COUNT 253 {BD076A9}>
                       :PENTITIES #<HASH-TABLE :TEST EQUALP :COUNT 68 {BD07899}>
                       :NOTATIONS #<HASH-TABLE :TEST EQUALP :COUNT 0 {BD07A89}>)
 ENTITY-RESOLVER    #<CLOSURE (LAMBDA (CXML::N CXML::H)) {C1ED945}>
CL-USER(54): (describe (dom:doctype **))
#<UTF8-DOM::DOCUMENT-TYPE {BD02001}>
is an instance of class #<STANDARD-CLASS UTF8-DOM::DOCUMENT-TYPE>.
The following slots have :INSTANCE allocation:
 PARENT              NIL
 CHILDREN            #()
 OWNER               #<UTF8-DOM::DOCUMENT {BD01A19}>
 READ-ONLY-P         NIL
 MAP                 NIL
 NAME                "html"
 PUBLIC-ID           "-//W3C//DTD XHTML 1.0 Transitional//EN"
 SYSTEM-ID           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
 ENTITIES            #<UTF8-DOM::NAMED-NODE-MAP {BD01FD1}>
 NOTATIONS           #<UTF8-DOM::NAMED-NODE-MAP {BD01FA9}>
 %INTERNAL-SUBSET    "unbound"



More information about the cxml-devel mailing list