Re: [xml] Bug #21194

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Wed Aug 23 2000 - 19:01:33 EDT


On Wed, Aug 23, 2000 at 09:06:28AM -0500, Kenneth Pronovici wrote:
> > Sure if the codde is okay it may be included in the next one.
> > One just need to worry about the fact that extenal subsets must follow
> > the given constraints:
>
> I doubt I have taken all of that into account properly, but I can fix it
> if you let me know what needs to be done. I'll let you look at the patches
> and decide whether they're appropriate or just a quick hack that doesn't
> fit with the way you want to organize things. If what I've written doesn't
> match what you want to see, I'll rewrite it so it does.

  Okay, I have looked at what your code does. This should not be needed
in practice, or rather handled in a different way. I explain:

  libxml already output such DOCTYPE informations, example:

~/XML -> cat test/wml.xml
<?xml version="1.0" ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
  <card id="card1" title="Rubriques 75008">
        <p>
                <a href="rubmenu.asp?CP=75008&#38;RB=01">Cin&#233;ma</a><br/>
        </p>

</card>
</wml>
~/XML -> ./xmllint test/wml.xml
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
  <card id="card1" title="Rubriques 75008">
        <p>
                <a href="rubmenu.asp?CP=75008&#38;RB=01">Cin&#xE9;ma</a><br/>
        </p>

</card>
</wml>

  So when parsing a document with DOCTYPE informations, the existing
routines dump those correctly i.e. the problem is not with the saving
functions but your document structure.
  I assume you actually build a document in memory, but parse the DtD
from the disk, and validate against it. The problem lies in the way
you prune the DtD in the document tree, just adding it as doc->extSubset
is not sufficient you should insert it as a node in the document child
list (before the root element but possibly after PIs or comments).
  The following is the beginning of the dump of the wml document
as built in memory by the parser:

~/XML -> ./xmllint --debug test/wml.xml
DOCUMENT
version=1.0
standalone=true
  DTD(wml), PUBLIC -//WAPFORUM//DTD WML 1.1//EN, SYSTEM http://www.wapforum.org/DTD/wml_1.1.xml
  ELEMENT wml
    TEXT
    content=
    ELEMENT card
    [...]

Notice the DTD element, that's what missing when you build your
document, just create it and it should work without change to libxml.
Just call:

 xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
                                         const xmlChar *name,
                                         const xmlChar *ExternalID,
                                         const xmlChar *SystemID);

 and it will create the missing node.
 Should be simpler for you and for me :-)

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
Message from the list xml@xmlsoft.org
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 23 2000 - 16:43:16 EDT