[xml] libxml2: Get the wrong number of occurrence of elements from DTD


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+)>

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);

       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.


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]