mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-31 09:49:23 +03:00
more work on grammars and refs/defs augmented/updated the regression tests
* relaxng: more work on grammars and refs/defs * test/relaxng/* result/relaxng/*: augmented/updated the regression tests Daniel
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Tue Feb 4 00:20:58 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* relaxng: more work on grammars and refs/defs
|
||||||
|
* test/relaxng/* result/relaxng/*: augmented/updated the
|
||||||
|
regression tests
|
||||||
|
|
||||||
Mon Feb 3 14:16:59 CET 2003 Daniel Veillard <daniel@veillard.com>
|
Mon Feb 3 14:16:59 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* relaxng: more work on name classes, except support
|
* relaxng: more work on name classes, except support
|
||||||
|
231
relaxng.c
231
relaxng.c
@ -105,6 +105,7 @@ typedef enum {
|
|||||||
XML_RELAXNG_DEF, /* a definition */
|
XML_RELAXNG_DEF, /* a definition */
|
||||||
XML_RELAXNG_REF, /* reference to a definition */
|
XML_RELAXNG_REF, /* reference to a definition */
|
||||||
XML_RELAXNG_EXTERNALREF, /* reference to an external def */
|
XML_RELAXNG_EXTERNALREF, /* reference to an external def */
|
||||||
|
XML_RELAXNG_PARENTREF, /* reference to a def in the parent grammar */
|
||||||
XML_RELAXNG_OPTIONAL, /* optional patterns */
|
XML_RELAXNG_OPTIONAL, /* optional patterns */
|
||||||
XML_RELAXNG_ZEROORMORE, /* zero or more non empty patterns */
|
XML_RELAXNG_ZEROORMORE, /* zero or more non empty patterns */
|
||||||
XML_RELAXNG_ONEORMORE, /* one or more non empty patterns */
|
XML_RELAXNG_ONEORMORE, /* one or more non empty patterns */
|
||||||
@ -140,8 +141,10 @@ struct _xmlRelaxNG {
|
|||||||
|
|
||||||
xmlHashTablePtr defs; /* define */
|
xmlHashTablePtr defs; /* define */
|
||||||
xmlHashTablePtr refs; /* references */
|
xmlHashTablePtr refs; /* references */
|
||||||
xmlHashTablePtr documents; /* all the documents loaded */
|
xmlHashTablePtr documents; /* all the documents loaded */
|
||||||
xmlHashTablePtr includes; /* all the includes loaded */
|
xmlHashTablePtr includes; /* all the includes loaded */
|
||||||
|
int defNr; /* number of defines used */
|
||||||
|
xmlRelaxNGDefinePtr *defTab;/* pointer to the allocated definitions */
|
||||||
void *_private; /* unused by the library for users or bindings */
|
void *_private; /* unused by the library for users or bindings */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -161,6 +164,7 @@ struct _xmlRelaxNGParserCtxt {
|
|||||||
|
|
||||||
xmlRelaxNGPtr schema; /* The schema in use */
|
xmlRelaxNGPtr schema; /* The schema in use */
|
||||||
xmlRelaxNGGrammarPtr grammar; /* the current grammar */
|
xmlRelaxNGGrammarPtr grammar; /* the current grammar */
|
||||||
|
xmlRelaxNGGrammarPtr parentgrammar;/* the parent grammar */
|
||||||
int flags; /* parser flags */
|
int flags; /* parser flags */
|
||||||
int nbErrors; /* number of errors at parse time */
|
int nbErrors; /* number of errors at parse time */
|
||||||
int nbWarnings; /* number of warnings at parse time */
|
int nbWarnings; /* number of warnings at parse time */
|
||||||
@ -175,6 +179,10 @@ struct _xmlRelaxNGParserCtxt {
|
|||||||
xmlChar *URL;
|
xmlChar *URL;
|
||||||
xmlDocPtr document;
|
xmlDocPtr document;
|
||||||
|
|
||||||
|
int defNr; /* number of defines used */
|
||||||
|
int defMax; /* number of defines aloocated */
|
||||||
|
xmlRelaxNGDefinePtr *defTab; /* pointer to the allocated definitions */
|
||||||
|
|
||||||
const char *buffer;
|
const char *buffer;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
@ -337,7 +345,6 @@ struct _xmlRelaxNGTypeLibrary {
|
|||||||
* Allocation functions *
|
* Allocation functions *
|
||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static void xmlRelaxNGFreeDefineList(xmlRelaxNGDefinePtr defines);
|
|
||||||
static void xmlRelaxNGFreeGrammar(xmlRelaxNGGrammarPtr grammar);
|
static void xmlRelaxNGFreeGrammar(xmlRelaxNGGrammarPtr grammar);
|
||||||
static void xmlRelaxNGFreeDefine(xmlRelaxNGDefinePtr define);
|
static void xmlRelaxNGFreeDefine(xmlRelaxNGDefinePtr define);
|
||||||
|
|
||||||
@ -430,6 +437,13 @@ xmlRelaxNGFree(xmlRelaxNGPtr schema)
|
|||||||
if (schema->includes != NULL)
|
if (schema->includes != NULL)
|
||||||
xmlHashFree(schema->includes, (xmlHashDeallocator)
|
xmlHashFree(schema->includes, (xmlHashDeallocator)
|
||||||
xmlRelaxNGFreeInclude);
|
xmlRelaxNGFreeInclude);
|
||||||
|
if (schema->defTab != NULL) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0;i < schema->defNr;i++)
|
||||||
|
xmlRelaxNGFreeDefine(schema->defTab[i]);
|
||||||
|
xmlFree(schema->defTab);
|
||||||
|
}
|
||||||
|
|
||||||
xmlFree(schema);
|
xmlFree(schema);
|
||||||
}
|
}
|
||||||
@ -459,24 +473,6 @@ xmlRelaxNGNewGrammar(xmlRelaxNGParserCtxtPtr ctxt)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlRelaxNGFreeDefineHash:
|
|
||||||
* @defines: a list of define structures
|
|
||||||
*
|
|
||||||
* Deallocate a RelaxNG definition in the hash table
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
xmlRelaxNGFreeDefineHash(xmlRelaxNGDefinePtr defines)
|
|
||||||
{
|
|
||||||
xmlRelaxNGDefinePtr next;
|
|
||||||
|
|
||||||
while (defines != NULL) {
|
|
||||||
next = defines->nextHash;
|
|
||||||
xmlRelaxNGFreeDefine(defines);
|
|
||||||
defines = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlRelaxNGFreeGrammar:
|
* xmlRelaxNGFreeGrammar:
|
||||||
* @grammar: a grammar structure
|
* @grammar: a grammar structure
|
||||||
@ -489,14 +485,14 @@ xmlRelaxNGFreeGrammar(xmlRelaxNGGrammarPtr grammar)
|
|||||||
if (grammar == NULL)
|
if (grammar == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (grammar->start != NULL)
|
if (grammar->next != NULL) {
|
||||||
xmlRelaxNGFreeDefine(grammar->start);
|
xmlRelaxNGFreeGrammar(grammar->next);
|
||||||
|
}
|
||||||
if (grammar->refs != NULL) {
|
if (grammar->refs != NULL) {
|
||||||
xmlHashFree(grammar->refs, NULL);
|
xmlHashFree(grammar->refs, NULL);
|
||||||
}
|
}
|
||||||
if (grammar->defs != NULL) {
|
if (grammar->defs != NULL) {
|
||||||
xmlHashFree(grammar->defs, (xmlHashDeallocator)
|
xmlHashFree(grammar->defs, NULL);
|
||||||
xmlRelaxNGFreeDefineHash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlFree(grammar);
|
xmlFree(grammar);
|
||||||
@ -516,37 +512,43 @@ xmlRelaxNGNewDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node)
|
|||||||
{
|
{
|
||||||
xmlRelaxNGDefinePtr ret;
|
xmlRelaxNGDefinePtr ret;
|
||||||
|
|
||||||
|
if (ctxt->defMax == 0) {
|
||||||
|
ctxt->defMax = 16;
|
||||||
|
ctxt->defNr = 0;
|
||||||
|
ctxt->defTab = (xmlRelaxNGDefinePtr *)
|
||||||
|
xmlMalloc(ctxt->defMax * sizeof(xmlRelaxNGDefinePtr));
|
||||||
|
if (ctxt->defTab == NULL) {
|
||||||
|
if ((ctxt != NULL) && (ctxt->error != NULL))
|
||||||
|
ctxt->error(ctxt->userData, "Out of memory\n");
|
||||||
|
ctxt->nbErrors++;
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
} else if (ctxt->defMax <= ctxt->defNr) {
|
||||||
|
xmlRelaxNGDefinePtr *tmp;
|
||||||
|
ctxt->defMax *= 2;
|
||||||
|
tmp = (xmlRelaxNGDefinePtr *) xmlRealloc(ctxt->defTab,
|
||||||
|
ctxt->defMax * sizeof(xmlRelaxNGDefinePtr));
|
||||||
|
if (tmp == NULL) {
|
||||||
|
if ((ctxt != NULL) && (ctxt->error != NULL))
|
||||||
|
ctxt->error(ctxt->userData, "Out of memory\n");
|
||||||
|
ctxt->nbErrors++;
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
ctxt->defTab = tmp;
|
||||||
|
}
|
||||||
ret = (xmlRelaxNGDefinePtr) xmlMalloc(sizeof(xmlRelaxNGDefine));
|
ret = (xmlRelaxNGDefinePtr) xmlMalloc(sizeof(xmlRelaxNGDefine));
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
if ((ctxt != NULL) && (ctxt->error != NULL))
|
if ((ctxt != NULL) && (ctxt->error != NULL))
|
||||||
ctxt->error(ctxt->userData, "Out of memory\n");
|
ctxt->error(ctxt->userData, "Out of memory\n");
|
||||||
ctxt->nbErrors++;
|
ctxt->nbErrors++;
|
||||||
return (NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(ret, 0, sizeof(xmlRelaxNGDefine));
|
memset(ret, 0, sizeof(xmlRelaxNGDefine));
|
||||||
|
ctxt->defTab[ctxt->defNr++] = ret;
|
||||||
ret->node = node;
|
ret->node = node;
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlRelaxNGFreeDefineList:
|
|
||||||
* @defines: a list of define structures
|
|
||||||
*
|
|
||||||
* Deallocate a RelaxNG define structures.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
xmlRelaxNGFreeDefineList(xmlRelaxNGDefinePtr defines)
|
|
||||||
{
|
|
||||||
xmlRelaxNGDefinePtr next;
|
|
||||||
|
|
||||||
while (defines != NULL) {
|
|
||||||
next = defines->next;
|
|
||||||
xmlRelaxNGFreeDefine(defines);
|
|
||||||
defines = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlRelaxNGFreePartition:
|
* xmlRelaxNGFreePartition:
|
||||||
* @partitions: a partition set structure
|
* @partitions: a partition set structure
|
||||||
@ -585,23 +587,15 @@ xmlRelaxNGFreeDefine(xmlRelaxNGDefinePtr define)
|
|||||||
if (define == NULL)
|
if (define == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ((define->data != NULL) &&
|
||||||
|
(define->type == XML_RELAXNG_INTERLEAVE))
|
||||||
|
xmlRelaxNGFreePartition((xmlRelaxNGPartitionPtr) define->data);
|
||||||
if (define->name != NULL)
|
if (define->name != NULL)
|
||||||
xmlFree(define->name);
|
xmlFree(define->name);
|
||||||
if (define->ns != NULL)
|
if (define->ns != NULL)
|
||||||
xmlFree(define->ns);
|
xmlFree(define->ns);
|
||||||
if (define->value != NULL)
|
if (define->value != NULL)
|
||||||
xmlFree(define->value);
|
xmlFree(define->value);
|
||||||
if (define->attrs != NULL)
|
|
||||||
xmlRelaxNGFreeDefineList(define->attrs);
|
|
||||||
if ((define->content != NULL) &&
|
|
||||||
(define->type != XML_RELAXNG_REF) &&
|
|
||||||
(define->type != XML_RELAXNG_EXTERNALREF))
|
|
||||||
xmlRelaxNGFreeDefineList(define->content);
|
|
||||||
if (define->nameClass != NULL)
|
|
||||||
xmlRelaxNGFreeDefineList(define->nameClass);
|
|
||||||
if ((define->data != NULL) &&
|
|
||||||
(define->type == XML_RELAXNG_INTERLEAVE))
|
|
||||||
xmlRelaxNGFreePartition((xmlRelaxNGPartitionPtr) define->data);
|
|
||||||
xmlFree(define);
|
xmlFree(define);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1572,6 +1566,8 @@ static int xmlRelaxNGParseGrammarContent(
|
|||||||
static xmlRelaxNGDefinePtr xmlRelaxNGParseNameClass(
|
static xmlRelaxNGDefinePtr xmlRelaxNGParseNameClass(
|
||||||
xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node,
|
xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node,
|
||||||
xmlRelaxNGDefinePtr def);
|
xmlRelaxNGDefinePtr def);
|
||||||
|
static xmlRelaxNGGrammarPtr xmlRelaxNGParseGrammar(
|
||||||
|
xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes);
|
||||||
|
|
||||||
|
|
||||||
#define IS_BLANK_NODE(n) \
|
#define IS_BLANK_NODE(n) \
|
||||||
@ -2202,7 +2198,6 @@ xmlRelaxNGParseDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
|||||||
"Could not create definition hash\n");
|
"Could not create definition hash\n");
|
||||||
ctxt->nbErrors++;
|
ctxt->nbErrors++;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
xmlRelaxNGFreeDefine(def);
|
|
||||||
} else {
|
} else {
|
||||||
tmp = xmlHashAddEntry(ctxt->grammar->defs, name, def);
|
tmp = xmlHashAddEntry(ctxt->grammar->defs, name, def);
|
||||||
if (tmp < 0) {
|
if (tmp < 0) {
|
||||||
@ -2216,7 +2211,6 @@ xmlRelaxNGParseDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
|||||||
name);
|
name);
|
||||||
ctxt->nbErrors++;
|
ctxt->nbErrors++;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
xmlRelaxNGFreeDefine(def);
|
|
||||||
} else {
|
} else {
|
||||||
while (prev->nextHash != NULL)
|
while (prev->nextHash != NULL)
|
||||||
prev = prev->nextHash;
|
prev = prev->nextHash;
|
||||||
@ -2325,7 +2319,6 @@ xmlRelaxNGParsePattern(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
|||||||
ctxt->error(ctxt->userData,
|
ctxt->error(ctxt->userData,
|
||||||
"Could not create references hash\n");
|
"Could not create references hash\n");
|
||||||
ctxt->nbErrors++;
|
ctxt->nbErrors++;
|
||||||
xmlRelaxNGFreeDefine(def);
|
|
||||||
def = NULL;
|
def = NULL;
|
||||||
} else {
|
} else {
|
||||||
int tmp;
|
int tmp;
|
||||||
@ -2342,7 +2335,6 @@ xmlRelaxNGParsePattern(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
|||||||
"Internal error refs definitions '%s'\n",
|
"Internal error refs definitions '%s'\n",
|
||||||
def->name);
|
def->name);
|
||||||
ctxt->nbErrors++;
|
ctxt->nbErrors++;
|
||||||
xmlRelaxNGFreeDefine(def);
|
|
||||||
def = NULL;
|
def = NULL;
|
||||||
} else {
|
} else {
|
||||||
def->nextHash = prev->nextHash;
|
def->nextHash = prev->nextHash;
|
||||||
@ -2410,6 +2402,81 @@ xmlRelaxNGParsePattern(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
|||||||
"xmlRelaxNGParse: notAllowed element is not empty\n");
|
"xmlRelaxNGParse: notAllowed element is not empty\n");
|
||||||
ctxt->nbErrors++;
|
ctxt->nbErrors++;
|
||||||
}
|
}
|
||||||
|
} else if (IS_RELAXNG(node, "grammar")) {
|
||||||
|
xmlRelaxNGGrammarPtr grammar, old;
|
||||||
|
xmlRelaxNGGrammarPtr oldparent;
|
||||||
|
|
||||||
|
oldparent = ctxt->parentgrammar;
|
||||||
|
old = ctxt->grammar;
|
||||||
|
ctxt->parentgrammar = old;
|
||||||
|
grammar = xmlRelaxNGParseGrammar(ctxt, node->children);
|
||||||
|
if (old != NULL) {
|
||||||
|
ctxt->grammar = old;
|
||||||
|
ctxt->parentgrammar = oldparent;
|
||||||
|
if (grammar != NULL) {
|
||||||
|
grammar->next = old->next;
|
||||||
|
old->next = grammar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (grammar != NULL)
|
||||||
|
def = grammar->start;
|
||||||
|
else
|
||||||
|
def = NULL;
|
||||||
|
} else if (IS_RELAXNG(node, "parentRef")) {
|
||||||
|
if (ctxt->parentgrammar == NULL) {
|
||||||
|
if (ctxt->error != NULL)
|
||||||
|
ctxt->error(ctxt->userData,
|
||||||
|
"Use of parentRef without a parent grammar\n");
|
||||||
|
ctxt->nbErrors++;
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
def = xmlRelaxNGNewDefine(ctxt, node);
|
||||||
|
if (def == NULL)
|
||||||
|
return(NULL);
|
||||||
|
def->type = XML_RELAXNG_PARENTREF;
|
||||||
|
def->name = xmlGetProp(node, BAD_CAST "name");
|
||||||
|
if (def->name == NULL) {
|
||||||
|
if (ctxt->error != NULL)
|
||||||
|
ctxt->error(ctxt->userData,
|
||||||
|
"parentRef has no name\n");
|
||||||
|
ctxt->nbErrors++;
|
||||||
|
}
|
||||||
|
if (node->children != NULL) {
|
||||||
|
if (ctxt->error != NULL)
|
||||||
|
ctxt->error(ctxt->userData,
|
||||||
|
"parentRef is not empty\n");
|
||||||
|
ctxt->nbErrors++;
|
||||||
|
}
|
||||||
|
if (ctxt->parentgrammar->refs == NULL)
|
||||||
|
ctxt->parentgrammar->refs = xmlHashCreate(10);
|
||||||
|
if (ctxt->parentgrammar->refs == NULL) {
|
||||||
|
if (ctxt->error != NULL)
|
||||||
|
ctxt->error(ctxt->userData,
|
||||||
|
"Could not create references hash\n");
|
||||||
|
ctxt->nbErrors++;
|
||||||
|
def = NULL;
|
||||||
|
} else {
|
||||||
|
int tmp;
|
||||||
|
|
||||||
|
tmp = xmlHashAddEntry(ctxt->parentgrammar->refs, def->name, def);
|
||||||
|
if (tmp < 0) {
|
||||||
|
xmlRelaxNGDefinePtr prev;
|
||||||
|
|
||||||
|
prev = (xmlRelaxNGDefinePtr)
|
||||||
|
xmlHashLookup(ctxt->parentgrammar->refs, def->name);
|
||||||
|
if (prev == NULL) {
|
||||||
|
if (ctxt->error != NULL)
|
||||||
|
ctxt->error(ctxt->userData,
|
||||||
|
"Internal error parentRef definitions '%s'\n",
|
||||||
|
def->name);
|
||||||
|
ctxt->nbErrors++;
|
||||||
|
def = NULL;
|
||||||
|
} else {
|
||||||
|
def->nextHash = prev->nextHash;
|
||||||
|
prev->nextHash = def;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
TODO
|
TODO
|
||||||
def = NULL;
|
def = NULL;
|
||||||
@ -2465,6 +2532,7 @@ xmlRelaxNGParseAttribute(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
|||||||
case XML_RELAXNG_VALUE:
|
case XML_RELAXNG_VALUE:
|
||||||
case XML_RELAXNG_LIST:
|
case XML_RELAXNG_LIST:
|
||||||
case XML_RELAXNG_REF:
|
case XML_RELAXNG_REF:
|
||||||
|
case XML_RELAXNG_PARENTREF:
|
||||||
case XML_RELAXNG_EXTERNALREF:
|
case XML_RELAXNG_EXTERNALREF:
|
||||||
case XML_RELAXNG_DEF:
|
case XML_RELAXNG_DEF:
|
||||||
case XML_RELAXNG_ONEORMORE:
|
case XML_RELAXNG_ONEORMORE:
|
||||||
@ -2547,9 +2615,7 @@ xmlRelaxNGParseExceptNameClass(xmlRelaxNGParserCtxtPtr ctxt,
|
|||||||
else
|
else
|
||||||
cur->type = XML_RELAXNG_ELEMENT;
|
cur->type = XML_RELAXNG_ELEMENT;
|
||||||
|
|
||||||
if (xmlRelaxNGParseNameClass(ctxt, child, cur) == NULL) {
|
if (xmlRelaxNGParseNameClass(ctxt, child, cur) != NULL) {
|
||||||
xmlRelaxNGFreeDefine(cur);
|
|
||||||
} else {
|
|
||||||
if (last == NULL) {
|
if (last == NULL) {
|
||||||
ret->content = cur;
|
ret->content = cur;
|
||||||
} else {
|
} else {
|
||||||
@ -2674,6 +2740,7 @@ xmlRelaxNGParseElement(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
|||||||
case XML_RELAXNG_VALUE:
|
case XML_RELAXNG_VALUE:
|
||||||
case XML_RELAXNG_LIST:
|
case XML_RELAXNG_LIST:
|
||||||
case XML_RELAXNG_REF:
|
case XML_RELAXNG_REF:
|
||||||
|
case XML_RELAXNG_PARENTREF:
|
||||||
case XML_RELAXNG_EXTERNALREF:
|
case XML_RELAXNG_EXTERNALREF:
|
||||||
case XML_RELAXNG_DEF:
|
case XML_RELAXNG_DEF:
|
||||||
case XML_RELAXNG_ZEROORMORE:
|
case XML_RELAXNG_ZEROORMORE:
|
||||||
@ -2749,13 +2816,14 @@ xmlRelaxNGParsePatterns(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes,
|
|||||||
cur->parent = parent;
|
cur->parent = parent;
|
||||||
} else {
|
} else {
|
||||||
cur = xmlRelaxNGParsePattern(ctxt, nodes);
|
cur = xmlRelaxNGParsePattern(ctxt, nodes);
|
||||||
if (def == NULL) {
|
if (cur != NULL) {
|
||||||
def = last = cur;
|
if (def == NULL) {
|
||||||
} else {
|
def = last = cur;
|
||||||
last->next = cur;
|
} else {
|
||||||
last = cur;
|
last->next = cur;
|
||||||
|
last = cur;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cur->parent = parent;
|
|
||||||
}
|
}
|
||||||
nodes = nodes->next;
|
nodes = nodes->next;
|
||||||
}
|
}
|
||||||
@ -3321,6 +3389,13 @@ xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxtPtr ctxt) {
|
|||||||
xmlFree(ctxt->docTab);
|
xmlFree(ctxt->docTab);
|
||||||
if (ctxt->incTab != NULL)
|
if (ctxt->incTab != NULL)
|
||||||
xmlFree(ctxt->incTab);
|
xmlFree(ctxt->incTab);
|
||||||
|
if (ctxt->defTab != NULL) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0;i < ctxt->defNr;i++)
|
||||||
|
xmlRelaxNGFreeDefine(ctxt->defTab[i]);
|
||||||
|
xmlFree(ctxt->defTab);
|
||||||
|
}
|
||||||
xmlFree(ctxt);
|
xmlFree(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3746,6 +3821,9 @@ xmlRelaxNGParse(xmlRelaxNGParserCtxtPtr ctxt)
|
|||||||
ctxt->documents = NULL;
|
ctxt->documents = NULL;
|
||||||
ret->includes = ctxt->includes;
|
ret->includes = ctxt->includes;
|
||||||
ctxt->includes = NULL;
|
ctxt->includes = NULL;
|
||||||
|
ret->defNr = ctxt->defNr;
|
||||||
|
ret->defTab = ctxt->defTab;
|
||||||
|
ctxt->defTab = NULL;
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
@ -3880,6 +3958,14 @@ xmlRelaxNGDumpDefine(FILE * output, xmlRelaxNGDefinePtr define) {
|
|||||||
xmlRelaxNGDumpDefines(output, define->content);
|
xmlRelaxNGDumpDefines(output, define->content);
|
||||||
fprintf(output, "</ref>\n");
|
fprintf(output, "</ref>\n");
|
||||||
break;
|
break;
|
||||||
|
case XML_RELAXNG_PARENTREF:
|
||||||
|
fprintf(output, "<parentRef");
|
||||||
|
if (define->name != NULL)
|
||||||
|
fprintf(output, " name=\"%s\"", define->name);
|
||||||
|
fprintf(output, ">\n");
|
||||||
|
xmlRelaxNGDumpDefines(output, define->content);
|
||||||
|
fprintf(output, "</parentRef>\n");
|
||||||
|
break;
|
||||||
case XML_RELAXNG_EXTERNALREF:
|
case XML_RELAXNG_EXTERNALREF:
|
||||||
fprintf(output, "<externalRef");
|
fprintf(output, "<externalRef");
|
||||||
xmlRelaxNGDumpDefines(output, define->content);
|
xmlRelaxNGDumpDefines(output, define->content);
|
||||||
@ -5081,8 +5167,9 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
|||||||
case XML_RELAXNG_ATTRIBUTE:
|
case XML_RELAXNG_ATTRIBUTE:
|
||||||
ret = xmlRelaxNGValidateAttribute(ctxt, define);
|
ret = xmlRelaxNGValidateAttribute(ctxt, define);
|
||||||
break;
|
break;
|
||||||
case XML_RELAXNG_EXTERNALREF:
|
|
||||||
case XML_RELAXNG_REF:
|
case XML_RELAXNG_REF:
|
||||||
|
case XML_RELAXNG_PARENTREF:
|
||||||
|
case XML_RELAXNG_EXTERNALREF:
|
||||||
ret = xmlRelaxNGValidateDefinition(ctxt, define->content);
|
ret = xmlRelaxNGValidateDefinition(ctxt, define->content);
|
||||||
break;
|
break;
|
||||||
case XML_RELAXNG_DATATYPE: {
|
case XML_RELAXNG_DATATYPE: {
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
error detected at relaxng.c:4920
|
error detected at relaxng.c:5006
|
||||||
error detected at relaxng.c:5223
|
error detected at relaxng.c:5310
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
error detected at relaxng.c:4925
|
error detected at relaxng.c:5011
|
||||||
error detected at relaxng.c:5223
|
error detected at relaxng.c:5310
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
error detected at relaxng.c:4925
|
error detected at relaxng.c:5011
|
||||||
error detected at relaxng.c:5223
|
error detected at relaxng.c:5310
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
error detected at relaxng.c:4932
|
error detected at relaxng.c:5018
|
||||||
error detected at relaxng.c:5223
|
error detected at relaxng.c:5310
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
error detected at relaxng.c:4932
|
error detected at relaxng.c:5018
|
||||||
error detected at relaxng.c:5223
|
error detected at relaxng.c:5310
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
xmlRelaxNGValidateAttribute(email): -1
|
xmlRelaxNGValidateAttribute(email): -1
|
||||||
xmlRelaxNGValidateAttribute(name): -1
|
xmlRelaxNGValidateAttribute(name): -1
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
xmlRelaxNGValidateAttribute(email): -1
|
xmlRelaxNGValidateAttribute(email): -1
|
||||||
xmlRelaxNGValidateAttribute(name): -1
|
xmlRelaxNGValidateAttribute(name): -1
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
xmlRelaxNGValidateAttribute(anyName): 0
|
xmlRelaxNGValidateAttribute(anyName): 0
|
||||||
xmlRelaxNGValidateAttribute(anyName): -1
|
xmlRelaxNGValidateAttribute(anyName): -1
|
||||||
error detected at relaxng.c:4968
|
error detected at relaxng.c:5054
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
xmlRelaxNGValidateAttribute(anyName): 0
|
xmlRelaxNGValidateAttribute(anyName): 0
|
||||||
xmlRelaxNGValidateAttribute(anyName): -1
|
xmlRelaxNGValidateAttribute(anyName): -1
|
||||||
error detected at relaxng.c:4968
|
error detected at relaxng.c:5054
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
|
1
result/relaxng/tutor11_3_1
Normal file
1
result/relaxng/tutor11_3_1
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/relaxng/tutor11_3_1.xml validates
|
3
result/relaxng/tutor11_3_1.err
Normal file
3
result/relaxng/tutor11_3_1.err
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
xmlRelaxNGValidateAttribute(anyName): 0
|
||||||
|
xmlRelaxNGValidateAttribute(anyName): 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated example : 0
|
1
result/relaxng/tutor11_4_1
Normal file
1
result/relaxng/tutor11_4_1
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/relaxng/tutor11_4_1.xml validates
|
4
result/relaxng/tutor11_4_1.err
Normal file
4
result/relaxng/tutor11_4_1.err
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
xmlRelaxNGValidateAttribute(anyName): 0
|
||||||
|
xmlRelaxNGValidateAttribute(anyName): -1
|
||||||
|
xmlRelaxNGValidateAttribute(space): 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated example : 0
|
1
result/relaxng/tutor12_1_1
Normal file
1
result/relaxng/tutor12_1_1
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/relaxng/tutor12_1_1.xml validates
|
4
result/relaxng/tutor12_1_1.err
Normal file
4
result/relaxng/tutor12_1_1.err
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
xmlRelaxNGValidateDefinition(): validated name : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated email : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated card : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated addressBook : 0
|
1
result/relaxng/tutor13_1_1
Normal file
1
result/relaxng/tutor13_1_1
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/relaxng/tutor13_1_1.xml validates
|
9
result/relaxng/tutor13_1_1.err
Normal file
9
result/relaxng/tutor13_1_1.err
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
xmlRelaxNGValidateDefinition(): validated p : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated em : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated td : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated tr : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated td : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated tr : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated table : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated p : 0
|
||||||
|
xmlRelaxNGValidateDefinition(): validated doc : 0
|
@ -1,3 +1,3 @@
|
|||||||
error detected at relaxng.c:4912
|
error detected at relaxng.c:4998
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
xmlRelaxNGValidateDefinition(): validated email : 0
|
xmlRelaxNGValidateDefinition(): validated email : 0
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
error detected at relaxng.c:5105
|
error detected at relaxng.c:5192
|
||||||
xmlRelaxNGValidateDefinition(): validated note : 0
|
xmlRelaxNGValidateDefinition(): validated note : 0
|
||||||
xmlRelaxNGValidateDefinition(): validated bad : -1
|
xmlRelaxNGValidateDefinition(): validated bad : -1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
xmlRelaxNGValidateAttribute(preferredFormat): -1
|
xmlRelaxNGValidateAttribute(preferredFormat): -1
|
||||||
xmlRelaxNGValidateAttribute(email): 0
|
xmlRelaxNGValidateAttribute(email): 0
|
||||||
xmlRelaxNGValidateAttribute(name): 0
|
xmlRelaxNGValidateAttribute(name): 0
|
||||||
error detected at relaxng.c:4968
|
error detected at relaxng.c:5054
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
xmlRelaxNGValidateDefinition(): validated name : 0
|
xmlRelaxNGValidateDefinition(): validated name : 0
|
||||||
xmlRelaxNGValidateDefinition(): validated email : 0
|
xmlRelaxNGValidateDefinition(): validated email : 0
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated preferredFormat : -1
|
xmlRelaxNGValidateDefinition(): validated preferredFormat : -1
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
xmlRelaxNGValidateAttribute(preferredFormat): -1
|
xmlRelaxNGValidateAttribute(preferredFormat): -1
|
||||||
xmlRelaxNGValidateAttribute(email): 0
|
xmlRelaxNGValidateAttribute(email): 0
|
||||||
xmlRelaxNGValidateAttribute(name): 0
|
xmlRelaxNGValidateAttribute(name): 0
|
||||||
error detected at relaxng.c:4968
|
error detected at relaxng.c:5054
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Unimplemented block at xmlschemastypes.c:1132
|
Unimplemented block at xmlschemastypes.c:1132
|
||||||
error detected at relaxng.c:4078
|
error detected at relaxng.c:4164
|
||||||
error detected at relaxng.c:5159
|
error detected at relaxng.c:5246
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated vector : -1
|
xmlRelaxNGValidateDefinition(): validated vector : -1
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Unimplemented block at xmlschemastypes.c:1132
|
Unimplemented block at xmlschemastypes.c:1132
|
||||||
Unimplemented block at xmlschemastypes.c:1132
|
Unimplemented block at xmlschemastypes.c:1132
|
||||||
error detected at relaxng.c:4266
|
error detected at relaxng.c:4352
|
||||||
error detected at relaxng.c:5159
|
error detected at relaxng.c:5246
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated vector : -1
|
xmlRelaxNGValidateDefinition(): validated vector : -1
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
error detected at relaxng.c:4241
|
error detected at relaxng.c:4327
|
||||||
error detected at relaxng.c:5159
|
error detected at relaxng.c:5246
|
||||||
xmlRelaxNGValidateDefinition(): validated vector : -1
|
xmlRelaxNGValidateDefinition(): validated vector : -1
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Unimplemented block at xmlschemastypes.c:1135
|
Unimplemented block at xmlschemastypes.c:1135
|
||||||
Unimplemented block at xmlschemastypes.c:1135
|
Unimplemented block at xmlschemastypes.c:1135
|
||||||
Unimplemented block at xmlschemastypes.c:1135
|
Unimplemented block at xmlschemastypes.c:1135
|
||||||
error detected at relaxng.c:4266
|
error detected at relaxng.c:4352
|
||||||
error detected at relaxng.c:5159
|
error detected at relaxng.c:5246
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated path : -1
|
xmlRelaxNGValidateDefinition(): validated path : -1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Unimplemented block at xmlschemastypes.c:1135
|
Unimplemented block at xmlschemastypes.c:1135
|
||||||
error detected at relaxng.c:4078
|
error detected at relaxng.c:4164
|
||||||
error detected at relaxng.c:5159
|
error detected at relaxng.c:5246
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated path : -1
|
xmlRelaxNGValidateDefinition(): validated path : -1
|
||||||
|
@ -3,5 +3,5 @@ xmlRelaxNGComputeInterleaves(interleave0)
|
|||||||
6 groups
|
6 groups
|
||||||
xmlRelaxNGValidateDefinition(): validated title : 0
|
xmlRelaxNGValidateDefinition(): validated title : 0
|
||||||
xmlRelaxNGValidateDefinition(): validated title : 0
|
xmlRelaxNGValidateDefinition(): validated title : 0
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated head : -1
|
xmlRelaxNGValidateDefinition(): validated head : -1
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
xmlRelaxNGComputeInterleaves(interleave0)
|
xmlRelaxNGComputeInterleaves(interleave0)
|
||||||
6 child
|
6 child
|
||||||
6 groups
|
6 groups
|
||||||
error detected at relaxng.c:4906
|
error detected at relaxng.c:4992
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated head : -1
|
xmlRelaxNGValidateDefinition(): validated head : -1
|
||||||
|
@ -4,5 +4,5 @@ xmlRelaxNGComputeInterleaves(interleave0)
|
|||||||
xmlRelaxNGValidateDefinition(): validated title : 0
|
xmlRelaxNGValidateDefinition(): validated title : 0
|
||||||
xmlRelaxNGValidateDefinition(): validated base : 0
|
xmlRelaxNGValidateDefinition(): validated base : 0
|
||||||
xmlRelaxNGValidateDefinition(): validated base : 0
|
xmlRelaxNGValidateDefinition(): validated base : 0
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated head : -1
|
xmlRelaxNGValidateDefinition(): validated head : -1
|
||||||
|
@ -4,5 +4,5 @@ xmlRelaxNGComputeInterleaves(interleave0)
|
|||||||
2 groups
|
2 groups
|
||||||
xmlRelaxNGValidateAttribute(name): 0
|
xmlRelaxNGValidateAttribute(name): 0
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
||||||
|
@ -5,5 +5,5 @@ xmlRelaxNGComputeInterleaves(interleave0)
|
|||||||
xmlRelaxNGValidateAttribute(name): 0
|
xmlRelaxNGValidateAttribute(name): 0
|
||||||
xmlRelaxNGValidateAttribute(email): 0
|
xmlRelaxNGValidateAttribute(email): 0
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
xmlRelaxNGValidateAttribute(name): 0
|
xmlRelaxNGValidateAttribute(name): 0
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
xmlRelaxNGValidateAttribute(name): 0
|
xmlRelaxNGValidateAttribute(name): 0
|
||||||
xmlRelaxNGValidateAttribute(email): 0
|
xmlRelaxNGValidateAttribute(email): 0
|
||||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||||
error detected at relaxng.c:4960
|
error detected at relaxng.c:5046
|
||||||
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
||||||
|
21
test/relaxng/table.rng
Normal file
21
test/relaxng/table.rng
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
|
||||||
|
|
||||||
|
<define name="cell.content">
|
||||||
|
<notAllowed/>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
<start>
|
||||||
|
<element name="table">
|
||||||
|
<oneOrMore>
|
||||||
|
<element name="tr">
|
||||||
|
<oneOrMore>
|
||||||
|
<element name="td">
|
||||||
|
<ref name="cell.content"/>
|
||||||
|
</element>
|
||||||
|
</oneOrMore>
|
||||||
|
</element>
|
||||||
|
</oneOrMore>
|
||||||
|
</element>
|
||||||
|
</start>
|
||||||
|
|
||||||
|
</grammar>
|
15
test/relaxng/tutor11_3.rng
Normal file
15
test/relaxng/tutor11_3.rng
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<element name="example" xmlns="http://relaxng.org/ns/structure/1.0">
|
||||||
|
<zeroOrMore>
|
||||||
|
<attribute>
|
||||||
|
<anyName/>
|
||||||
|
</attribute>
|
||||||
|
</zeroOrMore>
|
||||||
|
<optional>
|
||||||
|
<attribute name="xml:space">
|
||||||
|
<choice>
|
||||||
|
<value>default</value>
|
||||||
|
<value>preserve</value>
|
||||||
|
</choice>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
|
</element>
|
1
test/relaxng/tutor11_3_1.xml
Normal file
1
test/relaxng/tutor11_3_1.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<example foo="bar" xml:space="default"/>
|
19
test/relaxng/tutor11_4.rng
Normal file
19
test/relaxng/tutor11_4.rng
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<element name="example" xmlns="http://relaxng.org/ns/structure/1.0">
|
||||||
|
<zeroOrMore>
|
||||||
|
<attribute>
|
||||||
|
<anyName>
|
||||||
|
<except>
|
||||||
|
<name>xml:space</name>
|
||||||
|
</except>
|
||||||
|
</anyName>
|
||||||
|
</attribute>
|
||||||
|
</zeroOrMore>
|
||||||
|
<optional>
|
||||||
|
<attribute name="xml:space">
|
||||||
|
<choice>
|
||||||
|
<value>default</value>
|
||||||
|
<value>preserve</value>
|
||||||
|
</choice>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
|
</element>
|
1
test/relaxng/tutor11_4_1.xml
Normal file
1
test/relaxng/tutor11_4_1.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<example foo="bar" xml:space="default"/>
|
13
test/relaxng/tutor12_1.rng
Normal file
13
test/relaxng/tutor12_1.rng
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:a="http://www.example.com/annotation">
|
||||||
|
<zeroOrMore>
|
||||||
|
<element name="card">
|
||||||
|
<a:documentation>Information about a single email address.</a:documentation>
|
||||||
|
<element name="name">
|
||||||
|
<text/>
|
||||||
|
</element>
|
||||||
|
<element name="email">
|
||||||
|
<text/>
|
||||||
|
</element>
|
||||||
|
</element>
|
||||||
|
</zeroOrMore>
|
||||||
|
</element>
|
3
test/relaxng/tutor12_1_1.xml
Normal file
3
test/relaxng/tutor12_1_1.xml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<addressBook>
|
||||||
|
<card><name>foo</name><email>bar</email></card>
|
||||||
|
</addressBook>
|
33
test/relaxng/tutor13_1.rng
Normal file
33
test/relaxng/tutor13_1.rng
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
|
||||||
|
|
||||||
|
<start>
|
||||||
|
<element name="doc">
|
||||||
|
<zeroOrMore>
|
||||||
|
<choice>
|
||||||
|
<element name="p">
|
||||||
|
<ref name="inline"/>
|
||||||
|
</element>
|
||||||
|
<grammar>
|
||||||
|
<include href="table.rng">
|
||||||
|
<define name="cell.content">
|
||||||
|
<parentRef name="inline"/>
|
||||||
|
</define>
|
||||||
|
</include>
|
||||||
|
</grammar>
|
||||||
|
</choice>
|
||||||
|
</zeroOrMore>
|
||||||
|
</element>
|
||||||
|
</start>
|
||||||
|
|
||||||
|
<define name="inline">
|
||||||
|
<zeroOrMore>
|
||||||
|
<choice>
|
||||||
|
<text/>
|
||||||
|
<element name="em">
|
||||||
|
<ref name="inline"/>
|
||||||
|
</element>
|
||||||
|
</choice>
|
||||||
|
</zeroOrMore>
|
||||||
|
</define>
|
||||||
|
|
||||||
|
</grammar>
|
12
test/relaxng/tutor13_1_1.xml
Normal file
12
test/relaxng/tutor13_1_1.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<doc>
|
||||||
|
<p>start</p>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td> <em>hello</em> !</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<p>end</p>
|
||||||
|
</doc>
|
Reference in New Issue
Block a user