Re: [xml] Finding the root node from a DTD



On Tue, Mar 25, 2003 at 07:33:08PM -0800, Quandary wrote:
I'm trying to fill in 'root_node' in the following
code fragment:

xmlCreateIntSubset(docpDocument, root_node, NULL,
(xmlChar*) chpFileName);

If I parse the DTD file beforehand (with xmlParseDtd()
), is there any way for me to determine what the
name/root element is for that DTD?

I would -think- that there would be a solution to this
problem that is more generic than hard-coding
'root_node' or asking the user for the root element
every run, but I am just not seeing it.

  If you have the document, then pass its root node name
use xmlDocGetRootElement()
     - if root->ns == NULL || root->ns->prefix == NULL
       then pass root->name
     - else root->ns->prefix':'root->name

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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