[xml] DTD navigation within libxml



Hi there,

I'm using libxml v2.4.9 to load a DTD into memory. I load the DTD using the following code:

   xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");

xmlCreateIntSubset(doc, BAD_CAST "host_rm", BAD_CAST "-//XXX//YYY//EN", BAD_CAST dtd_file);

doc->extSubset = xmlParseDTD(doc->intSubset->ExternalID, doc->intSubset->SystemID);

I then navigate it by using xmlNodePtr to hold nodes. This enables me to extract all the elements and their attributes from the DTD, using the children and type properties of xmlNodePtr.

The question I have for the list is how do I find out how many subelements an element may contain ?

e.g. in my DTD I have
<!ELEMENT ACCUNIT (COUNTER*, REJECTREASON?, SYSTEM?)>

I'm trying to extract the logic that ACCUNIT may contain zero or more COUNTER elements then optional REJECTREASON and SYSTEM elements. Do functions/properties exist that could give me this info, where should I be looking ?

Apologies if this is a dumb question, I'm pretty new to the world of XML but desperately trying to get up to speed in it for a demanding project at work ! Any assistance much appreciated,

Thanks,

  James Binks




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx




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