From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Mon Oct 30 2000 - 11:45:22 EST
On Mon, Oct 30, 2000 at 11:26:48AM -0500, Harry Blundell wrote:
> 
> Okay, I've found the reason that I wasn't getting the <!DOCTYPE ... >
> written to the file when I called xmlSaveFile - as well as setting
> docPtr->intSubset = dtdPtr, I also needed to set
> 
>   docPtr->children = (xmlNodePtr) dtdPtr;
>   docPtr->last = (xmlNodePtr) dtdPtr;
> 
> so that the DTD is a child of the document.
> 
> I haven't looked into why I'm getting the Bus Error, but I've found a new
> problem (at least it is for me):
> 
> Daniel, in the new xmlIOParseDTD you provided, you call
> 
>   xmlNewDtd(ctxt->myDoc, BAD_CAST "none", BAD_CAST "none", BAD_CAST
>             "none");
> 
> What's the purpose of the "none" for the ExternalID and SystemID?
> When I attach the DTD to a document as an internal subset, and call
> xmlValidateDocument on it, it fails because it can't resolve the external
> entity "none".  Similarly, when I call xmlSaveFile, I get the line
> 
>   <!DOCTYPE result PUBLIC "none" "none" [
> 
> I can work around it by setting 
> 
>   dtdPtr->ExternalID = NULL;
>   dtdPtr->SystemID = NULL;
> 
> after the call to xmlIOParseDTD, but is the "none" necessary for another
> purpose?
  Well simply that a memory buffer has:
    - no ExternalID
    - no SystemID
 and you asked me to be able to use it without refering to a file.
So it simply can't have those !
 Now if you want to have them loadable dynamically save them to a file
and use the existing interface. Of course xmlValidateDocument fails
because you attach this DTd to the document like if it was part of
it while it's not. To validate a document against a xmlDtdPtr use
xmlValidateDtd() not xmlValidateDocument().
  At that point I'm very tempted to simply not include xmlIOParseDTD()
and ask you to save your DTd to a file. Seems to raise more problems
than to fix any.
Daniel
-- Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes | libxml Gnome XML toolkit Tel : +33 476 615 257 | 655, avenue de l'Europe | http://xmlsoft.org/ Fax : +33 476 615 207 | 38330 Montbonnot FRANCE | Rpmfind search site http://www.w3.org/People/all#veillard%40w3.org | http://rpmfind.net/ ---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net
This archive was generated by hypermail 2b29 : Mon Oct 30 2000 - 12:43:34 EST