[xml] libxml2: Get the wrong number of occurrence of elements from DTD
- From: "David Franklyn" <purine88 hotmail com>
- To: xml gnome org
- Subject: [xml] libxml2: Get the wrong number of occurrence of elements from DTD
- Date: Fri, 12 Mar 2004 15:43:39 -0500
Hi,
I am using DTDReader by Ashley Cambrell to parse a DTD file with some
modifications.
<?xml version='1.0' encoding='UTF-8'?>
<!ELEMENT foo (bar?, goo+)>
<!ELEMENT bar (#PCDATA)>
<!ELEMENT goo (#PCDATA)>
I want to get the number of occurrence for each element. For example, "bar"
should be optional, "goo" should be plus. However, the result is "one" for
both situations.
The code is this
int DTDReader::getElementOccur(const char * _elementName)
{
if(_elementName == NULL)
return -1;
xmlElementPtr elementFromDtd = xmlGetDtdElementDesc(dtd,
(xmlChar*)_elementName);
if(!elementFromDtd)
return -1;
return elementFromDtd->content->ocur;
}
In both situations, the return value is one, that is,
XML_ELEMENT_CONTENT_ONCE.
Thanks for your help in advance.
-David
_________________________________________________________________
Frustrated with dial-up? Lightning-fast Internet access for as low as
$29.95/month. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]