summaryrefslogtreecommitdiff
path: root/relaxng.c
diff options
context:
space:
mode:
Diffstat (limited to 'relaxng.c')
-rw-r--r--relaxng.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/relaxng.c b/relaxng.c
index a3088cbd..8725444b 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -5363,11 +5363,15 @@ xmlRelaxNGParseNameClass(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node,
xmlNodePtr child;
xmlRelaxNGDefinePtr last = NULL;
- ret = xmlRelaxNGNewDefine(ctxt, node);
- if (ret == NULL)
- return (NULL);
- ret->parent = def;
- ret->type = XML_RELAXNG_CHOICE;
+ if (def->type == XML_RELAXNG_CHOICE) {
+ ret = def;
+ } else {
+ ret = xmlRelaxNGNewDefine(ctxt, node);
+ if (ret == NULL)
+ return (NULL);
+ ret->parent = def;
+ ret->type = XML_RELAXNG_CHOICE;
+ }
if (node->children == NULL) {
xmlRngPErr(ctxt, node, XML_RNGP_CHOICE_EMPTY,
@@ -5379,7 +5383,7 @@ xmlRelaxNGParseNameClass(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node,
tmp = xmlRelaxNGParseNameClass(ctxt, child, ret);
if (tmp != NULL) {
if (last == NULL) {
- last = ret->nameClass = tmp;
+ last = tmp;
} else {
last->next = tmp;
last = tmp;