[xml] List valid values upon enumeration failure?
- From: Rick Jones <rick_jones2 hp com>
- To: xml gnome org
- Subject: [xml] List valid values upon enumeration failure?
- Date: Thu, 01 Aug 2002 18:00:03 -0700
I've been debugging a DTD and XML file for my netperf4 work and was
getting error messages like:
netperf_config.xml:118: validity error: Value "Tran" for attribute units
on throughput is not among the enumerated set
end="later">1235.67</throughput>
^
I have seen where that message is generated in valid.c - does anyone
else think that displaying the valid enumerated values would be of value
here? If so I may take a stab at a patch. It does look a triffle ugly -
having to build-up a string by walking the tree again:
/* Validity Constraint: Enumeration */
if (attrDecl->atype == XML_ATTRIBUTE_ENUMERATION) {
xmlEnumerationPtr tree = attrDecl->tree;
while (tree != NULL) {
if (xmlStrEqual(tree->name, value)) break;
tree = tree->next;
}
if (tree == NULL) {
VERROR(ctxt->userData,
"Value \"%s\" for attribute %s on %s is not among the enumerated
set\n",
value, attr->name, elem->name);
ret = 0;
}
}
I don't think it would be apropriate to build the list as the tree is
walked the first time - that would be optimizing for an error case.
Also, shouldn't that be "...for attribute %s of element %s..." (of
replacing on)? _That_ patch would be easy :)
rick jones
--
Wisdom Teeth are impacted, people are affected by the effects of events.
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to post, OR email to raj in cup.hp.com but NOT BOTH...
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]