
On Mon, Nov 05, 2007 at 11:19:36AM +0100, Arndt Jonasson wrote:
I have been using a local adaptation of dump-xsd.c to generate our own XML schema format, and (with some fixes which I have reported) it seems to work at least for all the standard IETF mibs. Understanding it fully hasn't been my primary concern, though, and there may be lurking bugs.
The problem is that (a) some DISPLAY-HINTs are not translated correctly and (b) you can't simply copy the SIZE restriction of an OCTET STRING when you move to a textual format; you actually have to translate the SIZE retrictions taking the DISPLAY-HINT transformation into account. Both, the XSD backend and the YANG backend currently do not do this. So what is needed is a rewrite of the translation code which not only tries to translate DISPLAY-HINTs into pattern but also returns new size restrictions that are meaningful in the "textual space".
Here is one more diff, which I forgot to report earlier. Also in fortopat.c:
if( iterDH->separator ) { /* iterDH->repTerm = hint[ pos++ ]; // repeat not supported */ pos++; } else { if( hint[ pos++ ] == '.' ) { iterDH->separator[0] = '\\'; iterDH->separator[1] = '.'; } else iterDH->separator[0] = hint[ pos ]; }
should be
if( iterDH->separator[0] ) { /* iterDH->repTerm = hint[ pos++ ]; // repeat not supported */ pos++; } else { iterDH->separator[0] = hint[ pos++ ]; if (iterDH->separator[0] == '.') { iterDH->separator[0] = '\\'; iterDH->separator[1] = '.'; } }
Thanks. Just checked in.
/js