diff options
Diffstat (limited to 'valid.c')
-rw-r--r-- | valid.c | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -1012,7 +1012,9 @@ xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob) else xmlDumpElementContent(buf, content->c1, 0); xmlBufferWriteChar(buf, " , "); - if (content->c2->type == XML_ELEMENT_CONTENT_OR) + if ((content->c2->type == XML_ELEMENT_CONTENT_OR) || + ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) && + (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE))) xmlDumpElementContent(buf, content->c2, 1); else xmlDumpElementContent(buf, content->c2, 0); @@ -1024,7 +1026,9 @@ xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob) else xmlDumpElementContent(buf, content->c1, 0); xmlBufferWriteChar(buf, " | "); - if (content->c2->type == XML_ELEMENT_CONTENT_SEQ) + if ((content->c2->type == XML_ELEMENT_CONTENT_SEQ) || + ((content->c2->type == XML_ELEMENT_CONTENT_OR) && + (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE))) xmlDumpElementContent(buf, content->c2, 1); else xmlDumpElementContent(buf, content->c2, 0); @@ -6582,6 +6586,14 @@ xmlValidGetPotentialChildren(xmlElementContent *ctree, const xmlChar **list, return(*len); } +/* + * Dummy function to suppress messages while we try out valid elements + */ +static void xmlNoValidityErr(void *ctx ATTRIBUTE_UNUSED, + const char *msg ATTRIBUTE_UNUSED, ...) { + return; +} + /** * xmlValidGetValidElements: * @prev: an element to insert after @@ -6627,14 +6639,15 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names, xmlElement *element_desc; - memset(&vctxt, 0, sizeof (xmlValidCtxt)); - if (prev == NULL && next == NULL) return(-1); if (names == NULL) return(-1); if (max <= 0) return(-1); + memset(&vctxt, 0, sizeof (xmlValidCtxt)); + vctxt.error = xmlNoValidityErr; /* this suppresses err/warn output */ + nb_valid_elements = 0; ref_node = prev ? prev : next; parent = ref_node->parent; |