[xml] xmlValidGetValidElements on root Node



Hi all,

I want to use the xmlValidGetValidElements(...) function
to know which children I can append to the root node of
my just built xml tree.

Here is the code:

doc = xmlNewDoc (BAD_CAST "1.0");
root_node = xmlNewNode(NULL, BAD_CAST "bidon");
xmlDocSetRootElement (doc, root_node);

 
/*
  * Creates a DTD declaration.
 */
 dtd =  xmlCreateIntSubset (doc, BAD_CAST "bidon", NULL, BAD_CAST "D:\\dtdlibxml\\test.dtd");
                                        
int* len;
const xmlChar* list = new xmlChar[10];

 
/*
  * Get valid elements.
 */
int res = xmlValidGetValidElements      (root_node ->last,
                                         NULL,
                                        &list,
                                        10);


But the function always return -1, because node->last is NULL because node is the root.

It seems not to be the good way to know possible children of the root.

How can I do?

Any help is welcome.

Thanks.
Sylvain.





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