[cxml-devel] Escape characters in first tag cause well-formed error

Mitch Berkson mitch at bermita.com
Sat Sep 16 09:20:43 UTC 2006


When I parse a file containing escape characters (& or <) in the first 
tag, CXML:parse-file gives the error message: "Error: Document not 
well-formed: entity not defined: amp".

Including the characters in other tags works fine.  Is this the expected 
behavior? Example:

Case 1 (escape character in first tag):
REPL> (with-open-file (s "example.xml" :direction :output  :if-exists 
:supersede)
    (write-string "<test a='b&'><child/></test>" s))

--> "<test a='b&'><child/></test>"

REPL> (cxml:parse-file "example.xml" (cxml-xmls:make-xmls-builder))

--> Error: Document not well-formed: entity not defined: amp
Context:
  Line 1, column 16 in file://+

Case 2 (escape character in second tag):
REPL> (with-open-file (s "example.xml" :direction :output :if-exists 
:supersede)
    (write-string "<test a='b'><child a='b&'/></test>" s))

-->  (cxml:parse-file "example.xml" (cxml-xmls:make-xmls-builder))
("test" (("a" "b")) ("child" (("a" "b&"))))

Edi Weitz suggests that ENSURE-DTD may be called too late in the P/DOCUMENT 
function.

Thanks for any help.

Mitch




More information about the cxml-devel mailing list