[XML-SIG] Ann: xvif 0.2.0

Eric van der Vlist vdv@dyomedea.com
27 Sep 2002 13:48:14 +0200


I am happy to anounce the release 0.2.0 of my xvif (XML Validation
Interoperability Framework) including a partial implementation of Relax
NG and a very partial implementation of W3C XML Schema datatypes.

The major change in this version is a clean up of the xvif syntax (the
xvif "pipe" element now bahaves as a full class Relax NG pattern) which
becomes slightly more verbose but allows to write schemas with
"fallback" Relax NG patterns which are fully conform to Relax NG and yet
can define pipes which will be used by xvif processors.

The test suites can now be browsed online and links have been created
between the online validator, the strawman and the test cases.

Links:
http://downloads.xmlschemata.org/python/xvif/
http://downloads.xmlschemata.org/python/xvif/xvif.html
http://downloads.xmlschemata.org/python/xvif/tryMe.cgi
http://downloads.xmlschemata.org/python/xvif-0.2.0.tgzhttp://ibook.paris.dy=
omedea.com/downloads/python/xvif/tests/

Maybe more interesting for this list even though in a very early stage,
I have started to implement some minimal support of datatype libraries.
This should be considered as a proof of concept, but I am trying to see
to which attempt simple types can be assimilated to Python classes and
builtin types and, so far, I quite like the result.

For a simple type library such as Relax NG core datatypes, the
definition of the 2 builtin types is as simple as:

class stringType(unicode):
 """
	This class is strictly identical to the python's unicode type
 """

class tokenType(unicode):

	def __new__(cls, value=3D""):
		return unicode.__new__(cls, string.strip(re.sub("[\n\t ]+", " ",
value)))

(http://downloads.xmlschemata.org/python/xvif/rngCoreTypeLib.py)

My Relax NG implementation uses a dictionary associating a library URI
and a module and does all the associations by introspection of the
module: the name of the types match the name of the classes defined in
this module (modulo a suffix) and the validation is done by creating a
new instance in a "try/except" block.

Things are sometimes less simple for W3C XML Schema and its facets but
still I think that the approach is interesting.

(http://downloads.xmlschemata.org/python/xvif/wxsTypeLib.py)

The definition of xs:integer for instance matches quite well the Python
"long" builtin type:

class integerType(long, _Numeric):
	"""
	"""

(Numeric is a generic class with the definition of facets common to the
numeric types.)

and a type such as byte can be defined as:

class byteType(_Bounded, intType):

	min =3D -128
	max =3D  127


I don't know if there will be concrete applications, but I like the idea
that I can use these types by themselves like:

>>> import wxsTypeLib
>>> x =3D wxsTypeLib.byteType(1)
>>> x =3D wxsTypeLib.byteType(100+x)
>>> x =3D wxsTypeLib.byteType(100+x)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "./wxsTypeLib.py", line 79, in __init__
    raise ValueError
ValueError

Things are more tricky for types such as decimals or datetimes, but they
could be useful by themselves too.

Finally, about unicode support, you won't find yet much of what has been
recently discussed in the version with the only exception of
smart_len()...

(http://downloads.xmlschemata.org/python/xvif/Smart_len.py)

More will come in next versions!

Thanks for your help (and of course, your comments are welcome),

Eric
--=20
Rendez-vous =E0 Paris.
                          http://www.technoforum.fr/integ2002/index.html
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------