From: Thomas J. <tho...@in...> - 2003-09-14 12:40:37
|
> > I wanted to replace a dtd reference in a parsed document with a new one. > > Just > > > calling set_internal_subset doesn't work, libxml checks if we already > > have > > at > > > dtd and breaks. > > > > So I wrote the clear_internal_subset function. > > Shouldn't set_internal_subset() do this automatically, without us adding a > method? It sounds like a and_make_it_work() method - something that belongs > in implementation instead of API. This is what Daniel Veillard wrote to me on the libxml mailinglist: (about freeing the DTD, but I guess the same is true if you try to change the DTD) > All the refernces to the items defined in the DTD like entities > will become dandling pointers to freed areas. Might work for a > given application, but a very bad interface to expose in a library API. > Changing the strings in the DTD sounds safer, but probably don't > match what you expect. I would only allow this transformation as part > of a saving mechanism to avoid the broken references problem I'm still thinking about the best solution right now, creating an empty document and use importNode() is only the last option. As I just want to validate against a given DTD, perhaps I could implement a validateAgainstExternalDTD() function in libxml++. Thomas |