Re: [xml] Finding the root node from a DTD
- From: Morus Walter <morus walter tanto-xipolis de>
- To: Quandary <ai2097 yahoo com>, xml gnome org
- Subject: Re: [xml] Finding the root node from a DTD
- Date: Wed, 26 Mar 2003 08:39:57 +0100
Quandary writes:
Hi all. I've been tearing hair for a couple days now
trying to solve this (seemingly) simple problem;
hopefully someone here can point out what I'm
overlooking...
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.
I cannot comment on xmlCreateIntSubset but in general
DTD's don't specify a root element, so it's impossible to get
it from there. So even if you parse the DTD, you wont get what you want.
Ok. You might try to find elements that have no possible parents, but
there might be more than one such element and there might be none
(the later being bad design IMHO but not illegal).
E.g. what's the root node in
<!ELEMENT a (c)*>
<!ELEMENT b (c)*>
<!ELEMENT c (#PCDATA)>
or
<!ELEMENT a (b)>
<!ELEMENT b (a*)>
And there is no rule, not to documents with root element c in the first
example.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]