Re: [xml] Deleting unused internal entities



On Wed, Dec 23, 2009 at 05:04:16PM -0800, Dustin Voss wrote:
Hello. I am creating a tree with a number of internal entity definitions and I am using the XML_PARSE_NOENT 
option. The resulting document has an internal subset that defines these entities, but they are never used 
in the actual document.
  okay

What's the best way to remove those unnecessary definitions? I do not want to remove the entire internal 
subset, because there may be external entities defined there.

  The doc should have a dtd node and the internal entities definitions
withh be carried as child of this dtd node.

Is it enough to delete nodes from xmlDoc->intSubset->children, or do I have to remove the entities from the 
xmlDoc->intSubset->entities hash table as well? Will xmlDoc->intSubset->next have anything of interest?

  Hum, yes you would still have entities 

To delete nodes, I don't see an xmlDeleteNode function, but I do see xmlReplaceNode. Can I pass in NULL for 
the "cur" parameter?

  xmlUnlinkNode + xmlDeleteNode is the traditional way

To access the entity hash table, can I just cast xmlDoc->intSubset->entities to xmlHashTablePtr and call 
xmlHashRemoveEntry? What should I pass for the "f" parameter?

  Hum, that should not be needed as the value put in the hash table is
the entity node.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]