xml tools [and VOTable.xsd]
Gerard Lemson
gerard.lemson at mpe.mpg.de
Fri May 23 06:47:21 PDT 2003
(First appologies if I mention here something that is already well known.
This is my first real investigation of VOTable and XML parsing tools.)
I have applied all the three tools mentioned by Will on the VOTable schema
version 1.0d
obtained from http://cdsweb.u-strasbg.fr/xml/VOTable.xsd.
None of the tools I tried, JAXB, Castor and .Net's xsd.exe parse that schema
without problems.
Below a superficial comparison after half a day of attempts.
1.
The version of JAXB I used is jaxb-1.0 which comes with Sun's Java
webservices developer pack 1.1.
JAXB's xjs.bat, when used as is, complains that "A property with the same
name "Value" is generated from more than one schema component."
The cause of this is the attribute of name "value" for the complex types
generated for the elements MIN, MAX, and LINK.
The problem here is that JAXB automatically generates a property "value" for
complex types that extend a simple type, which these do. This property
corresponds to the content of the element in the XML document.
For every XML attribute a property is generated with the name of the
attribute. This gives a clash when the name of the attribute is "value".
Changing these names, for example to "minValue", "maxValue", "linkValue"
solves this problem. However, does it not make more sense to remove
these attributes completely ? After all a minimum value can be described as
<MIN inclusive="no">0</MIN>
just as well as
<MIN value="0" inclusive="no"/>
2.
The Castor tool was version 0.9.4.3.
It avoids the problem of JAXB by not generating a "value" propoerty, but a
"content". So attributes with that name must be avoided.
Castor has another problem, namely that it does not recognize the "token"
datatype. It does recognize "normalizedString" though.
3.
I also tried the xsd.exe coming with Microsoft's .Net Framework 1.0, version
1.0.3705.
Also this tool does not recognize token, but does recognize
normalizedString.
I don't really know what to expect from this tool, simply ran it in two
modes, /classes and /dataset.
The former has no problems, the latter produces the error
"- The same table (OPTION) cannot be the child table in two nested
relations."
I do not know what this means here, but maybe someone with more XML Schema
knowledge understands this.
4.
>From previous experience I really liked working with JAXB, though that was
in the old version that only supported DTDs.
After fixing the "value" problem, I noticed that the generated code does not
seem to represent the XML in all detail. For example, the type
"yesno" that is defined in the VOTable schema is not represented in the
generated Java. Fields with this type are simply assigned
the type java.lang.String and no enumeration checking is performed. In
contrast, Castor does generate a proper class Yesno which can only be
instantiated with a "yes" or a "no" string.
(Btw, why not simply use "boolean" instead of a separate type yes/no?)
I would appreciate comments from anyone who knows whether and if so how
these problems can be resolved within the tools themselves, for example
using mapping, or binding configuration files.
Gerard Lemson
-----Original Message-----
From: Wil O'Mullane [mailto:womullan at skysrv.pha.jhu.edu]
Sent: Tuesday, May 20, 2003 11:10 AM
To: interop at ivoa.net
Subject: xml tools
Castor provides XML/XSD serialiasation support in java
http://castor.exolab.org/xmlschema.html
Java advanced XML binding also does this
http://java.sun.com/xml/jaxb/
but castor may be better.
This is the equivalent of what xsd.exe does for .NET.
These are the type of tools I think our XSD should work with
wil
More information about the interop
mailing list